Menu bars on main stack and different menus on substacks

Richard Gaskin ambassador at fourthworld.com
Mon Dec 29 15:37:33 EST 2008


Martin Koob wrote:

> Richard Gaskin <ambassador at ...> writes: 
>> 
>> Why do you want to do that?
>> 
>> Might it be easier to just follow Apple's guidelines and enable/disable 
>> menus items as needed?
> 
> I had been doing that, enabling and disabling items but I have added a
> feature to a new card so now one menu item should have submenus on one
> card and no submenus on another card.  This is how I would like the file
> menu to appear.
> 
> Card 1
> 
> File 
> 	New Project... 
> 	Open Project... 
> 	Save Project 
> 	Close Project
> 
> Card 3 
> File 
> 	New Project 
> 		>from existing movie... 
> 		>from recording... 
> 	Open Project 
> 	Save Project 
> 	Close Project
> 
> 
> To this point I just disabled the New Project item on card three and
> added a New Project menu button to the card that shows the two options
> when clicked.  I want to move that function back into the menu for
> consistency so that Is why I was looking at changing the menu bar.  I
> guess the other way is to change the menu so that there are three
> submenus to handle all options and enable them depending on the context.

Being the lazy person I am, I wonder what the downside would be to just 
leave the two sub-menu items in place across all the cards.  But I also 
recognize that I have no idea what the app does, so that may not be a 
suitable option. :)

If not, one approach I've used for menu updating is to store a list of 
items in a custom prop, and on mouseDown in the menu group I populate 
the menu buttons, adding, deleting, or modifying items as needed.  With 
Rev 2.7 forward the mousedown message is sent to a menu group even when 
using a keyboard menu shortcut, and even with the mouse it completes 
processing before the menu is displayed, so one mouseDown handler lets 
me handle all menu updates gracefully.

This might seem that it would be slow, but the engine is amazingly fast 
with this sort of thing; I doubt you'd ever notice any impairment in 
responsiveness.

--
  Richard Gaskin
  Fourth World
  Revolution training and consulting: http://www.fourthworld.com
  Webzine for Rev developers: http://www.revjournal.com



More information about the use-livecode mailing list