• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Crossing the NIB?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: Crossing the NIB?
      • From: Ondra Cada <email@hidden>
References: 
 >Re: Crossing the NIB? (From: Albert Atkinson <email@hidden>)

  • Prev by Date: Re: Drag and Drop in a NSView:Mouse coordinates
  • Next by Date: Re: Drag and Drop in a NSView:Mouse coordinates
  • Previous by thread: Re: Crossing the NIB?
  • Next by thread: Re: Crossing the NIB?
  • Index(es):
    • Date
    • Thread