Naive menu question

Jan Schenkel janschenkel at yahoo.com
Mon Jan 20 07:57:01 EST 2003


--- Graham Samuel <livfoss at blueyonder.co.uk> wrote:
> Coming from a MacOS background, I think I understand
> the 
> 'defaultMenu' and 'menuBar' ideas, but I'm less
> comfortable with 
> Windows-type menus that live inside a stack window.
> I can't seem to 
> find from the docs, wiki, etc a tip about how to
> have the same menu 
> bar (set of menus) in several stacks. I'd like to
> have say 5 stacks 
> which offer the same menu options to the user (with 
> maybe some of 
> them disabled). Do I have to duplicate the menubar
> group for each 
> window and put all the logic in an object further up
> the message 
> path, or what?
> 
> As usual, apologies if this is already grindingly
> obvious in the 
> docs, but I have tried...
> 
> TIA
> 
> Graham

Hi Graham,

I've found that basically, there are three ways to go
:
1) create a separate menubar "palette" stack
2) maintain duplicates per window (and thus per stack)
3) building the entgire menubar on the fly

- If you go for the first option, you create a
separate stack that holds the menubar (and no other
windows will have one) and from your mainStack :
  palette "menuBarStack"
You will have to juggle around with the 'topStack' and
'defaultStack' properties to determine which stack
you're working with before selecting an item in the
menubar.

- If you go for the second option, you can try and
avoid some of the hassles of synchronising these
menubars, by having a 'fixed' set of menus (eg always
'File-Edit-Entry-Reports-Special-Help') and then
changing their items 'on the fly' in a 'preOpenStack'
handler.
This approach will work best if you move the logic to
a 'higher' place in the message path -- to this end
you could apply the 'menuMessages' trick I described
in an earlier post:
http://lists.runrev.com/pipermail/use-revolution/2003-January/011262.html

- If you go for the third option, you'll have a bit
more 'creative' work to do : you can 'clone' the
'default' menubar group and place it on (every card
of) your stack in its 'preOpenStack' handler.
This will also transfer the logic as the scripts are
effectively copied, but it's not an ideal solution if
you have many cards in the stack.

Hope this helped,

Jan Schenkel.

=====
"As we grow older, we grow both wiser and more foolish at the same time."  (La Rochefoucauld)

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com



More information about the use-livecode mailing list