Built Menu not firing the action
Built Menu not firing the action
- Subject: Built Menu not firing the action
- From: Steve Cronin <email@hidden>
- Date: Mon, 25 Aug 2008 02:53:23 -0500
Folks;
I'm building a data driven submenu programmatically.
The submenu appears correctly in the UI with the correct titles but
nothing happens when these items are selected.
submenu build code:
menu1 = [[[NSMenu alloc] initWithTitle:@"__"] retain];
[menu1 setAutoenablesItems:NO];
NSEnumerator *titleEnum = [someArray objectEnumerator];
while ((nextTitle = [titleEnum nextObject])!=nil) {
[menu1 addItemWithTitle:nextTitle action:@selector(customAction:)
keyEquivalent:@""];
}
...
[[[[[[mainMenu itemAtIndex:3] submenu] itemWithTag:1000] submenu]
itemWithTag:1003] setSubmenu: menu1];
I spit menu1 out to NSLog and it looks fine.
I set a breakpoint at customAction: it NEVER gets called.
(Yes I have spelled it correctly [- (void) customAction:(id)sender;]
This is on the mainMenu in the main XIB file. There is an outlet from
appDelegate for mainMenu, this is set.
The menu itself has the appDelegate set as its' delegate.
The selector method is o method in the appDelegate object.
There are no selector bindings set.
(Note: there are enabled bindings set which are working correctly)
I'm just stumped! I probably could use some sleep...
Also how do you show some useful data from a SEL value in NSLog? ie
print [NSMenuItem action]?
Since nothing happens how do I debug this?
Thank-you for any insights!
Steve
_______________________________________________
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