Re: Help with First Responder
Re: Help with First Responder
- Subject: Re: Help with First Responder
- From: j o a r <email@hidden>
- Date: Mon, 23 Dec 2002 16:48:41 +0100
If you only wan't to post messages to the current first responder from
code, then look at this method in NSApplication:
- (BOOL)sendAction:(SEL)anAction to:(id)aTarget from:(id)sender
Something like this:
[NSApp sendAction: @selector(myMethod) to: nil from: self];
If you want to also connect to methods in IB that you yourself have
defined and implemented, simply:
* Open your nib file in IB
* Double-click the first responder icon to activate the classes tab.
* Open the inspector to the attributes pop-up item
* Select the actions tab and add the selectors for your own action
methods.
Don't forget that a proper action method has this selector:
- (void) myMethod:(id) sender;
j o a r
On Monday, Dec 23, 2002, at 16:26 Europe/Stockholm, Ted Lowery wrote:
I can't seem to understand how to make the first responder chain work.
I have a menu command that I'd like to send a message to the current
main (key?) window. This is easy enough with the canned messages that
MainMenu's first responder respond to. But what about adding my own
messages? I have a method in the controller for my document that I
can call from a button on the window, but there doesn't seem to be a
way to connect the menu to the document's nib.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.