I have added an item to the Arbortext edit menu. It calls an external service. I used timer_add_callback to poll the service occasionally to see if the menu item should be available. Then I used menu_change to enable or disable the menu item appropriately.
This all works until the user uses "Edit selection as XML source", because that displays a new window. When the timer goes off, the menu item doesn't exist in the XML-as-source window, and an error dialog pops up.
I tried calling menu_change inside catch, like this: catch( 'menu_change ".Edit.Use service" -active "$$polledOK" )
That stops the error dialog, and the catch returns 0. But the menu item state never changes.
- Am I doing something wrong in the catch? - Or is there some way of telling if the menu item is available? - Or is there a way to refer to the menu item in the right window?