Menubar on Windows???

Ken Ray kray at sonsothunder.com
Wed Dec 12 13:47:01 EST 2007


This may help deal with things conceptually (ignore the docs for now, 
as there are a few errors in there related to menus):

1) A "menubar" is a group that contains buttons of the pulldown 
variety, that sits at the top of a stack. (For the examples below, I'll 
call the group "myMenus".)

2) On OS X, in order to show that group in the true Mac menu bar, you 
need to do two things: declare that your group of buttons is really a 
"menubar", and force the stack to resize itself to move the group up 
and out of the way so you don't see both the group of buttons AND the 
true menubar at the same tie. To do this, you manipulate the "menubar" 
and "editMenus" properties of a stack:

     set the menubar of this stack to "myMenus"  
     -- puts your menus in the true menu bar
 
     set the editMenus of this stack to false
     -- causes the stack resizing to hide the group of buttons 
     -- (it doesn't actually change the "visible" of the group, 
     -- it just resizes the stack to automatically push the group
     -- above the visible card area - note this only happens on
     -- OS X; setting the editMenus on Win/Lin doesn't do
     -- anything (but if the same stack is opened on a Mac, 
     -- whatever is the current editMenus setting will take place)

3) On OS X, if you want the same group of menus to be shown in the true 
menu bar for all currently open stacks, you can set the 
"defaultMenubar" global property.

4) On Windows (not Vista) and Linux (I believe), you *do not need* to 
do anything other than position your group of button in the right place 
and adjust normal props to make them look like Windows/Linux menus 
(border, font, etc.). Nothing is harmed by setting "the menubar" of the 
stack to the group, but nothing is gained either, AFAICT.

In all of the above cases, Rev displays the menu that drops down in a 
compliance with the OS, and attempts to make the menu *buttons* (for 
Win and Lin) compliant as well.

5) On Windows Vista, however, the group and the menu buttons themselves 
will not display properly (the rollover "roundrect" on the menu buttons 
and the graduated background of the group won't be displayed) *unless* 
you "set the menubar" of the stack to the group. As soon as you do 
that, you get the rollovers and the proper graduated background of the 
group.

BOTTOM LINE: It's better to "set the menubar" in all OS'es, even if 
it's not necessary in some.

Finally, the only OS that can have a single set of menus (i.e. a single 
group with buttons) that applies to all or multiple stacks is OS X. All 
other OSes require individual group objects with buttons for their 
"menubars" because the menus are displayed in the window and not in a 
specialized location managed by the OS (as it is in OS X). There are 
clever hacks and libraries to attempt to simulate a "shared" menu bar, 
but in actuality they are still separate groups. So in order to get a 
"shared" menu bar in Win/Lin, you need to either use the hacks, or 
remove the menus from stacks entirely and create a single floating 
palette that holds the menus.

Hope this helps,

Ken Ray
Sons of Thunder Software, Inc.
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/



More information about the use-livecode mailing list