Re: Built Menu not firing the action
Re: Built Menu not firing the action
- Subject: Re: Built Menu not firing the action
- From: Peter Ammon <email@hidden>
- Date: Mon, 25 Aug 2008 11:20:25 -0700
On Aug 25, 2008, at 12:53 AM, Steve Cronin wrote:
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.
[...]
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)
The most likely problem is that the object implementing the method is
not in the responder chain. What object do you get if you call [NSApp
targetForAction:@selector(customAction:)]?
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]?
For debugging purposes, the easiest thing to do is to cast it to a
char*, e.g.:
gdb) p (char *)[someMenuItem action]
For your actual code, you should use the NSStringFromSelector()
function, as the char* nature of selectors is not guaranteed.
-Peter
_______________________________________________
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