• 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: Connecting menu item to controller in different nib
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Connecting menu item to controller in different nib


  • Subject: Re: Connecting menu item to controller in different nib
  • From: Matthew Roberts <email@hidden>
  • Date: Wed, 24 Jul 2002 15:06:40 -0500

Thanks Ondra. I played around, adding a new action to the MainMenu nib's
First Responder and then adding the code for it to the document class.
Worked great.

However, I'm now trying to hook this up for a menu whose items I populate at
run-time. After searching the archives (and not finding much) and playing
around, I got it to work. The loop that creates the menuitem sets its
target to "self" (an AppController) and its action to a method implemented
in the AppController). All that method does is pass the buck, calling:

[NSApp sendAction:@selector(newLibItem:) to:nil from:sender];

NewLibItem is in turn defined in the document source, where it correctly
runs.

Is there a way to streamline this process? It seems like I should be able
to set the menuitem's target to something other than self--somehow hook it
right into the responder chain so that it checks for newLibItem directly and
finds it in the chain. However, I can't figure out what to setTarget: to.

_________________________________
Matthew Roberts (email@hidden)
Ph.D. Candidate, Dept. of Political Science
Instructional Technology Fellow
University of Minnesota
http://www.polisci.umn.edu/graduate/students/mroberts


On 7-24-02 10:34 AM, "Ondra Cada" <email@hidden> wrote:

> Ouch. Generally, check docs and archives, this very question is in both...
>
> Well: connect the item(s) to the First Responder, and make sure the
> document controller understands the message. The rest (that always the
> controller of the main window is the one who gets the message if the menu
> item is selected) is ensured by White Cocoa Magic (if interested how the
> magic works, study NSResponder.html and NSDocument/Controller.html).
> ---
> Ondra bada
> OCSoftware: email@hidden http://www.ocs.cz
> private email@hidden http://www.ocs.cz/oc
_______________________________________________
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: Connecting menu item to controller in different nib
      • From: Ondra Cada <email@hidden>
References: 
 >Re: Connecting menu item to controller in different nib (From: Ondra Cada <email@hidden>)

  • Prev by Date: What's the format of InfoPlist.strings?
  • Next by Date: alloc/init nested deep in long statement. okay or not?
  • Previous by thread: Re: Connecting menu item to controller in different nib
  • Next by thread: Re: Connecting menu item to controller in different nib
  • Index(es):
    • Date
    • Thread