unable to select submenu item
unable to select submenu item
- Subject: unable to select submenu item
- From: SRD <email@hidden>
- Date: Wed, 18 Nov 2009 16:45:01 -0600
Sorry to have to post this again, but I have been unable to understand
why this isn't working.
I have an NSView with an NSPopUpButton within it. The NSPopUpButton is
of type 'Pull Down'. This NSView is in the toolbar of my application,
it looks just like the 'Action' button in the toolbar of XCode (Add
--> New Build Phase --> New Copy Files Build Phase).
I built this with IB. My problem is that I am unable to read anything
when selecting an NSMenuItem from the submenu. I don't understand why
the menu item I am selecting is not reporting a submenu, rather, it
seems to be null as if there is no submenu.
- (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>
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)
I read the interface guidelines and didn't see any reason for this not
to work. Any help much appreciated.
_______________________________________________
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