Re: unable to select submenu item
Re: unable to select submenu item
- Subject: Re: unable to select submenu item
- From: Keary Suska <email@hidden>
- Date: Thu, 19 Nov 2009 09:01:18 -0700
On Nov 18, 2009, at 7:27 PM, SRD wrote:
>> Here your code indicates that the "Load" menu item was selected, and according to everything you show, "Load" does *not* have a submenu, so everything is working as expected, unless you aren't selecting "Load", in which case your problem isn't the same as you describe.
>
> Apologies, I grabbed the wrong output. Below is the output taken from
> selecting a submenu item ...
>
> 2009-11-18 20:24:40.341 test[6053:a0f] projectMenu = <NSMenu: 0x10045c540>
> Title: ProjectMenu
> Supermenu: 0x0 (None), autoenable: NO
> Items: (
> "<NSMenuItem: 0x10045c3e0 >",
> "<NSMenuItem: 0x10045c650 Create, submenu: 0x10045c580 (Create)>",
> "<NSMenuItem: 0x10045d330 Load>",
> "<NSMenuItem: 0x10045d730 >",
> "<NSMenuItem: 0x10045d7b0 Save>",
> "<NSMenuItem: 0x10045d860 Save As ...>"
> )
> 2009-11-18 20:24:40.341 test[6053:a0f] menuItem <NSMenuItem: 0x10045c3e0 >
> 2009-11-18 20:24:40.342 test[6053:a0f] hasSubMenu 0
> 2009-11-18 20:24:40.342 test[6053:a0f] submenu (null)
> 2009-11-18 20:24:40.343 test[6053:a0f] end
IIRC, you are using a pulldown, so you want (or at least are asking for) menu-like behavior, so don't set the action on the NSPopupButton--set each action on the individual menu items. They can call the same action.
The behavior you are seeing above is expected, AFAIK, when using pulldowns. Pulldowns don't maintain selection state as they are only for command execution. See the doc "Application Menu and Pop-up List Programming Topics for Cocoa".
HTH,
Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden