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: Wed, 18 Nov 2009 17:12:51 -0700
On Nov 18, 2009, at 3:45 PM, SRD wrote:
> - (IBAction) readMenuSelection:(id) sender
> {
> NSMenu *projectMenu = [sender menu];
> NSLog(@"projectMenu = %@", projectMenu);
>
> NSMenuItem *menuItem = [sender selectedItem];
> NSLog(@"menuItem %@", menuItem);
> NSLog(@"hasSubMenu %d", [menuItem hasSubmenu]);
>
> NSMenu *subMenu = [menuItem submenu];
> NSLog(@"submenu %@", subMenu);
>
>
> // output below when selecting an item within the submenu.
> 2009-11-18 16:29:46.614 test[4968:a0f] projectMenu = <NSMenu: 0x100369be0>
> Title: ProjectMenu
> Supermenu: 0x0 (None), autoenable: NO
> Items: (
> "<NSMenuItem: 0x100369a80 >",
> "<NSMenuItem: 0x100369d30 Create, submenu: 0x100369c20 (Create)>",
> "<NSMenuItem: 0x100318200 Load>",
> "<NSMenuItem: 0x1003603c0 >",
> "<NSMenuItem: 0x10036a570 Save>",
> "<NSMenuItem: 0x10036ab70 Save As ...>"
> )
> 2009-11-18 16:29:46.615 test[4968:a0f] menuItem <NSMenuItem: 0x100318200 Load>
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.
> 2009-11-18 16:29:46.616 test[4968:a0f] hasSubMenu 0
> 2009-11-18 16:29:46.617 test[4968:a0f] submenu (null)
>
> My Menu is structured as follows:
>
> NSPopUpButton
> |- Create (NSMenu) -> TestItem (NSMenuItem)
> |- Load (NSMenuItem)
> |- Save (NSMenuItem)
> `- Save As (NSMenuItem)
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