Re: Crossing the NIB?
Re: Crossing the NIB?
- Subject: Re: Crossing the NIB?
- From: Timothy Ritchey <email@hidden>
- Date: Wed, 17 Apr 2002 08:19:12 -0500
First responder in the menu NIB is IMHO a little weird to get a handle
on, and I only recently think I have a clue as to how it is supposed to
work.
The problem is that the first responder in your MainMenu.nib does not
know about any classes and their actions in your other nibs. It is
simply a proxy for whatever classes REALLY are in the responder chain.
You need to let it know what actions are available. As an example, say
you have a document based application, with a MyDocument.nib. In the
traditional PB template, you should have a class called MyDocument. say
you have an action in it called:
- (IBAction)openDrawer:(id)sender;
You need to open up MainMenu.nib (NOT MyDocument.nib). Select the first
responder icon, and then select the Class tab. Make sure FirstResponder
is selected, and open the info panel. You then select the attributes
pane, and add a new action, naming it: openDrawer. Save this change. If
I understand correctly, first responder is simply a proxy for whatever
object happens to have first responder. In this case, you are telling
the proxy there is a new action of which it should be aware.
Now, you can ctrl-drag from the menu item to first responder, and
select this new action as the target for the menu item. Save this whole
thing, and you should be good to go. When you select the menu item, the
action will be propagated through the responder chain, and the action in
your MyDocument class should be called.
Hope this helps,
tim
On Tuesday, April 16, 2002, at 05:38 PM, Albert Atkinson wrote:
Hello!
OK, pretty much I am using a menu item in "MainMenu.nib" to open a
window in "MyDocument.nib" It would not accept a connection to First
Responder and I do not understand MVC. How would I hard code it?
Thanks for your help!
Albert
On Tuesday, April 16, 2002, at 05:28 PM, Ondra Cada wrote:
_______________________________________________
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.