defaultMenuBar question

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
phaworth
Posts: 592
Joined: Thu Jun 11, 2009 9:51 pm

defaultMenuBar question

Post by phaworth » Thu Aug 05, 2010 2:37 am

I have used the Menu Builder to define an OSX menu that I want to be the default menubar for all my stacks and it does indeed appear no matter which stack I open. So far so good.

I'm now writing some general purpose handlers to manipulate the contents of menus and have a function that returns the menuitems of one specific menu in the menubar. In order to do this, I check if the menubar property of the current stack is empty and if it is, I use the defaultMenuBar as the source for all subsequent actions. What I've found is that the defaultMenuBar is set to group "revMenuBar" of card "card id 1002" of stack "/Applications/Revolution Studio/4.0.0-gm-1/Toolset/revmenubar.rev".

I have not explicitly set the defaultMenubar anywhere in my code because I didn't know of it's existence initially and when I found it I assumed I didn't need to set it because my menu bar appears correctly when any stack is displayed.

So I guess the question is - do I have to set the defaultMenuBar property and if so why, or am I misunderstanding it's contents?

Thanks,
Pete

Janschenkel
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 977
Joined: Sat Apr 08, 2006 7:47 am
Contact:

Re: defaultMenuBar question

Post by Janschenkel » Thu Aug 05, 2010 6:57 pm

You should set the 'defaultMenubar' only in the standalone. In the IDE, "revMenubar" is the defaultMenubar - until you override it, that is, and it may reclaim that position.

HTH,

Jan Schenkel.
Quartam Reports & PDF Library for LiveCode
www.quartam.com

phaworth
Posts: 592
Joined: Thu Jun 11, 2009 9:51 pm

Re: defaultMenuBar question

Post by phaworth » Thu Aug 05, 2010 7:10 pm

Thanks Jan, I suspected something of that nature. Makes testing in the IDE pretty hard!

I still don't understand why the menu bar I've defined appears for any card in my application since it's not defined as a menubar for any of them and I haven't set the defaultmenubar property. Is it because I've defined the menu bar on my application's main stack? I guess I shouldn't worry about it since it seems to be working fine, just curious.

Rather than use the defaultMenuBar property, I've decided to use the contents of the menubar property of the main stack since that lets me test things in the IDE.

Thanks,
Pete

Post Reply