Menu bars on main stack and different menus on substacks

Martin Koob mkoob at rogers.com
Mon Dec 29 11:11:22 EST 2008




J. Landman Gay <jacque at ...> writes:

> 
> william humphrey wrote:
> > Menubars on main stack and substack
> > Hi
> > 
> > I know what happens with a menu on the mainstack and none on any of the
> > substacks but I was wondering how to implement a menu that changes depending
> > on what stack is opened. If you put a different menubar in a substack does
> > it happen automatically?
> 
> On Windows, yes. Menus on that OS are just groups, and they will show up 
> automatically in whatever stack you place them.
> 
> On Mac OS, the menubar group is moved to the system menu (and the stack 
> size is shortened as the menu scrolls out of view off the top.) For that 
> OS, you'll need to set the menubar property of the stack to the name of 
> the group. You only need to do that once during development. After that, 
> whenever the stack comes forward, it's own menubar will replace the 
> other one automatically.
> 
> Every stack can have its own menubar. If you want no menubar at all on 
> Windows it isn't a problem, just don't create one. On Macs, there must 
> be something in the system menu; you can't have an empty system menu. 
> For Macs, choose one of your menubar groups (from any open stack) and 
> set it (once during development) as the defaultMenubar. When you do 
> this, the default menu you've set up will display whenever a stack does 
> not have its own menubar assigned.
> 
> In the IDE, the default menubar belongs to Rev, so you'll see better 
> results from this approach if you only set a default menubar in your 
> standalone. If you set it during development, you are apt to lose the 
> IDE's menubar.
> 
>   Can you put just one menu item in the substack and
> > get it to add that item to the main menu when that substack is open and then
> > when you go to a different substack a different item is added?
> 
> You can, but it takes a lot of script tinkering with buttons and 
> layering and contents, etc. It's much easier to just duplicate an 
> existing menubar, change what's necessary, place it in a stack, and 
> assign that as the menubar for the stack.
> 

Hi.

I want to do what you have described and change the menus on the menubar
as I switch between different cards in the same stack.  ( I am using Mac
OS 10.5  with Rev 3.0 ) I don't want to do this in the application I am
working on till I get it right so  I have set up a test stack "menutest"
to try this out. Once I created the seondcard I created a second menubar
from scratch using the Menubuilder tool.  I use the following commands
in the card scripts of the stack's two cards.


card maincard's script 

on opencard 
    set the menubar of stack "menutest"to "mainMenubar" 
end opencard

card secondcard's script 

on opencard 
     set the menubar of stack "menutest" to "secondMenubar" 
end opencard

The result is that the menubars do change but  the stack gets shorter
and each time I switch from the second card to the first card or visa
versa.  So my question is do I have to reset the stack height each time
as part of these scripts or is there another way to prevent the height
change?

As well on the second card I get the "MainMenubar" group  appearing in
the secondcard window as buttons with the "secondMenuBar" in the menu
bar of the Mac.  How do I prevent this from happening?

I have tried also setting the defaultmenubar in the above scripts but as
you noted in the development enviroment I loose the revolution IDE
menubar and have to quit and relauch Revolution to get it back.

Another question is how do I properly duplicate the menubar.  Menu
Builder does not have a way to duplicate the menubar as far as I can
see.  (I don't want to have to create my menubar from scratch with menu
builder, I would rather duplicate and make changes.)

I tried to duplicate the mainmenubar group in the application browser on
card maincard but the duplicate option was disabled.   I then tried to
duplicate the group "secondMenuBar" on card secondcard (where the
'duplicate' menu item was available)was successful in duplicating it and
renaming it as "thirdMenubar". However in the application browser I
could see that it appeared only on card secondcard not on card maincard.
 I could use the 'thirdMenubar' on the second card if I substituted it
in the open card script for card secondcard so perhaps there is no
problem having this group only on the card that I will be using the menu
on. (I have noticed new cards created after the new menubar was created
will get the newly created menubar group placed on them as a background.
  If I create a menu bar with the Menubuilder it creates the group on on
all existing cards.)

There is an option when creating a menubuilder to 'move objects down to
accomodate menubar' that probably is the answer to the card shortening
problem.  What should the proper setting be for Mac OS and also how can
I set that option when I duplicate the menubar and then set it by
script.


Any further explanation of this would be welcome.

Thanks in advance

Martin








More information about the use-livecode mailing list