cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

Toolbar button toggle?

jonathan.reeve
1-Newbie

Toolbar button toggle?

I've added a toolbar button by customising $APTCUSTOM/dialogs/editwindow.xml as suggested in previous Adepters answers. That's working fine.

My button calls a remote service that may or may not be available, and I'd like to change the state of the button to indicate this. It looks as if I can poll the remote service occasionally with timer_add_callback, but I can't see how to change the button to make it "disabled". Is this possible?


Jonathan Reeve
Practical Law Company










This e-mail from Practical Law Company (
1 REPLY 1

Hi Jonathan--

Sure, you can do this using dlgitem_set() to toggle the "ACTIVE"
attribute, like this:

function updateToolbar() {
local button_id = "Toolbar_AccessService"; # modify as necessary
for your toolbar button ID
if (serviceIsAvailable()) {
# good to go, make the button available
dlgitem_set(current_window(),$button_id ,"ACTIVE",1);
}
else {
# something's wrong, so disable the button
dlgitem_set(current_window(),$button_id ,"ACTIVE",0)
}
}

--Clay

Clay Helberg
Senior Consultant

TerraXML
1380 Forest Park Circle, Suite 100
Lafayette, CO 80027
Top Tags