Disabling MenuItems

Rob Cozens rcozens at pon.net
Thu Dec 8 10:42:25 EST 2005


Hi Joe,

>Can menuitems be addressed by name rather than number? I don't always have
>the items in the same position.

Rev Dictionary (disable menu command) does not show menuItem name as 
an option; but you could--

         get the text of button id 12345 -- or button "File", if you must
         put offset(menuItemName,it) into itemOffset
         if char (itemOffset-1) of it = "(" then exit handlerName
         put "(" before char itemOffset of it
         set the text of button id 12345 to it

to disable and reverse logic to enable.

I avoid addressing even menus by name, because the same menu button 
may have a different name in each language my application supportins.

Addressing menus as button text has two things going for it;

1.  It seems to work more reliably than "disable menuItem y of menu x"

2.  It is the only way to manipulate menus in in preOpenStack logic: 
the stack menu gets set somewhere between preOpenStack and openStack.

Rob Cozens CCW
Serendipity Software Company

"And I, which was two fooles, do so grow three;
  Who are a little wise, the best fooles bee."

  from "The Triple Foole" by John Donne (1572-1631) 




More information about the use-livecode mailing list