Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: NSDirectoryEnumerator Question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSDirectoryEnumerator Question




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>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.