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

Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X

How to change the command of a button in the toolbar

dgopois
12-Amethyst

How to change the command of a button in the toolbar

Hello,

 

Under Arbortext software and with Arbortext Command Language (ACL), it's possible to change the command of a menu (with the "menu_change" function). But is it possible to change the command of a button in the toolbar ? If yes, how to do ?

 

Regard

David

1 ACCEPTED SOLUTION

Accepted Solutions

You could do this by redefining the command for the desired button. If you look at $ARBORTEXT/lib/dialogs/editwindow.xml, you will see the definitions for the standard toolbars, including the command each toolbar button executes. So, find the button you want to redefine, make a note of its command (shown in the command attribute), and in your startup ACL code, use the "alias" command to redefine it to use your code instead of standard code. For example, if you want to change what the "Open File" toolbar button does, you could use something like this:

function my_file_open() {
# do something custom here
}

alias FileOpen my_file_open();

Now that toolbar button will execute your function instead of the standard behavior.

 

Note that this may also effect the behavior of corresponding menu items, e.g. the above would likely also change what happens when you select File->Open from the menus. Normally this is what you want, but in some cases maybe not.

 

If you need to change ONLY the toolbar button, you could put a copy of editwindow.xml in your custom folder (in the dialogs subfolder), and change the command attribute for the button. You can define your own command alias as shown above, and assign it to your custom editwindow.xml file. That way the toolbar button is changed, but any menu items or other uses of the original command are not affected.

 

View solution in original post

2 REPLIES 2

You could do this by redefining the command for the desired button. If you look at $ARBORTEXT/lib/dialogs/editwindow.xml, you will see the definitions for the standard toolbars, including the command each toolbar button executes. So, find the button you want to redefine, make a note of its command (shown in the command attribute), and in your startup ACL code, use the "alias" command to redefine it to use your code instead of standard code. For example, if you want to change what the "Open File" toolbar button does, you could use something like this:

function my_file_open() {
# do something custom here
}

alias FileOpen my_file_open();

Now that toolbar button will execute your function instead of the standard behavior.

 

Note that this may also effect the behavior of corresponding menu items, e.g. the above would likely also change what happens when you select File->Open from the menus. Normally this is what you want, but in some cases maybe not.

 

If you need to change ONLY the toolbar button, you could put a copy of editwindow.xml in your custom folder (in the dialogs subfolder), and change the command attribute for the button. You can define your own command alias as shown above, and assign it to your custom editwindow.xml file. That way the toolbar button is changed, but any menu items or other uses of the original command are not affected.

 

Hello Clay,

 

Thanks for your response.

 

Regards

 

David

Top Tags