Menus

Sarah Reichelt sarah.reichelt at gmail.com
Thu Oct 8 19:32:07 EDT 2009


On Fri, Oct 9, 2009 at 8:39 AM,  <DunbarX at aol.com> wrote:
> Slowly getting menus to work.
>
> In a large HC stack of mine, the menuItems of a single menu called
> "doStuff" changes depending on which card I am on. Same name, different menuItems.
> In practice, as I navigate, I could delete and recreate the menu and its
> menuItems, or I could simply change the menuItems themselves (and of course
> their menuMessages).
>
> In Rev, is there a preferred way to do this? Do you make a new group for
> each card, and set the menuBar property? Or change the contents within a
> single group (I am not even sure how to do this) as you navigate?

Have a mouseDown handler in the menubar group itself (there is a
button in the Menu manager to edit this script), and in that handler,
work out what card you are on and change the menuItems accordingly.
Remember that menus are really only buttons and the menuItems are the
contents of that button, so you just need to say:
    put newItems into btn "doStuff"

You could have a custom property with the same name on each card that
contains the list of menuItems, so then you would not need to even
check which card you were on, but just have:
    put the cMenuContents of this card into btn "doStuff"

The script of the doStuff menu button will have to have the code to
handle all the possible options.

Cheers,
Sarah



More information about the use-livecode mailing list