OSX menubars

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

OSX menubars

Post by phaworth » Mon Jul 26, 2010 2:24 am

Looking for some assistance on manipulating menubars on OSX.

I've set up the menus using the Menu Builder Tool and they all appear on the OSX menubar at the top of the screen. The menubar is defined on the main stack of my application and is the default menu for the whole application.

When I'm in other substacks of the app, I need to be able to enable and disable selected menu items depending on data conditions and I see there are enable and disable commands in Rev to do that. However, my menus have cascading items and it appears that if I enable a submenu item, I also need to enable the menu item that it belongs to. The catch 22 is that if I enable the owning menu item, it enables ALL it's submenus which is not what I want to do.

Here's an example using a menu named Menu1; it has the following structure:

Menu Item 1
Submenu item 1.1
Submenu item 1.2
Menu Item 2
Submenu item 2.1
Submenu item 2.2

Let's say that Menu item 1 is disabled and I want to enable just submenu item 1.1. If I enable submenu item 1.1, I still can't get to it because Menu item 1 is still disabled. But if I enable Menu Item 1 then both submenu item 1.1 AND submenu item 1.2 are enabled. The problem gets more complex if there is more than one level of submenus.

It seems that the Rev enable and disable commands won't do the job for me and it sounds like I'll have to write my own handlers to deal with this situation which sounds like ti could be a real pain so I'm hoping someone else has dealt with this situation in the past and would be willing to share the code. I need it to be as general purpose as possible since I need to deal with several different menus from several different stacks.

Help!

Pete

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: OSX menubars

Post by Mark » Mon Jul 26, 2010 9:02 am

Hi Pete,

The answer is simple. Rather then disabling a menu item, you need to enable or disable all of its submenu items. This is how it is done in other platforms like XCode and Visual Express as well.

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

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

Re: OSX menubars

Post by phaworth » Mon Jul 26, 2010 5:05 pm

So if a main menu item is disabled and I want to enable just one of it's subitems,I need to enable the main menu item then go through each subitem and either enable or disable it.

I guess I thought that would be the case but was hoping to avoid the extra code. The main problem feels like its identifying the sub items of the main items, especially if there's multiple levels of menus.

Pete

Post Reply