Skip to main content
13-Aquamarine
July 18, 2018
Solved

In ACL language, how to activate a customized menu depending on the context

  • July 18, 2018
  • 1 reply
  • 1518 views

Hello,

Under Arbortext Editor and  with ACL language, I would like to activate a customized menu (grayed or not) depending on the context. For example, if the cursor of the mouse is in a specific tag, the customized menu is activated. If not, the menu is disabled (grayed).

Best answer by dgopois

Hello,

 

We can use this function to active or not the menu:

function activeMenu() {
if (in_context("tagname") != 1) {
return 0;
}
return 1;
}

 

and use the command lines to add the menu:

menu_add -menu -before .Help 'TEST';

menu_add .TEST. "TEST1" -cmd { test() } \
-active "activeMenu() == 1";

 

Best regards

David G

1 reply

dgopois13-AquamarineAuthorAnswer
13-Aquamarine
August 9, 2018

Hello,

 

We can use this function to active or not the menu:

function activeMenu() {
if (in_context("tagname") != 1) {
return 0;
}
return 1;
}

 

and use the command lines to add the menu:

menu_add -menu -before .Help 'TEST';

menu_add .TEST. "TEST1" -cmd { test() } \
-active "activeMenu() == 1";

 

Best regards

David G