• 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: NSDirectoryEnumerator Question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSDirectoryEnumerator Question


  • Subject: Re: NSDirectoryEnumerator Question
  • From: Michael Nickerson <email@hidden>
  • Date: Wed, 16 Aug 2006 05:10:24 -0400


On Aug 15, 2006, at 9:47 PM, Brian Amerige wrote:

I'm trying make some menu items for my project, but in order to get the IBActions to appear in the FirstResponder action list, I need them to be in my MyDocument.h file, not my AppController.h (where the actual methods i need to call are in AppController.m).

I know I can get this done by manually keeping the methods that I want to use as Menu IBActions in both AppController.m and MyDocument.m in sync, but I don't think that's the proper way to do this.

Any suggestions?

Thanks,
Brian.

You don't need the actions to appear in a header file to add them to the First Responder object in the nib. You can add action methods to the First Responder object directly. At run time, when the method is called, it goes up the responder chain until it finds something that implements that action and uses that. So the object it calls doesn't necessarily have to be in the nib file at all.


As long as your AppController class is in the responder chain (and if it's NSApplication's delegate, it is), then the methods there will be called.

If it helps, setting an action's target to the First Responder object is like programatically setting the target to nil. i.e. [menuItem setTarget:nil]; [menuItem setAction:@selector(someAction:)];



Darkshadow
(aka Michael Nickerson)



Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >NSDirectoryEnumerator Question (From: Brian Amerige <email@hidden>)

  • Prev by Date: Re: NSDirectoryEnumerator Question
  • Next by Date: Re: Capture WebView in a NSImage
  • Previous by thread: Re: NSDirectoryEnumerator Question
  • Next by thread: Newbie Question on Style
  • Index(es):
    • Date
    • Thread