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

Checking for an existing popup menu or menu bar menu

ptc-953343
1-Newbie

Checking for an existing popup menu or menu bar menu

Is there a simple way to test if a given menu item or popup menu
already exists?

I have an instance.acl file that creates the menu bar items and a
popup menu. On loading a new copy of that instance I get a message
about the popup already defined below the command line. Maybe the
menubar items say this as well, but the popup is the last item defined.

My second problem is around the use of the toggle on a menu item. I
have a XUI window that I have the close window event mapped to check
and uncheck this as well as turnoff the functionality. That works as
long as the main document is still open and the menu still exists. If
the XUI window is closed because I'm closing the application
document, then I get a Java exception which says my menu item is no
longer defined to uncheck.

thanks

..dan
2 REPLIES 2

Never mind menu_exists is the command. had to look for this
separately, its not listed as a related command on the menu_add help screen.

..dan

according to your toggle problem:



you perhaps want to try to let the editor do this work for you.

menu_add supports the option "-toggle", where you can add an expression to evaluate if the menuitem should be marked or not.

I personally use a seperated variable for this, so i can easly turn it on or of by setting the variable. To make it clear, here some code:



menu_add .YourMenu. "YourApplication" -cmd { package::function() } -toggle 'package::variable != 0'



so everytime you set 'package::variable' on some value different from zero the menuitem is marked.

setting back on zero removes the marking.



greetings

Andi

Announcements