Re: DocumentController & ApplicationController: messages between them?
Re: DocumentController & ApplicationController: messages between them?
- Subject: Re: DocumentController & ApplicationController: messages between them?
- From: Carlos Weber <email@hidden>
- Date: Sat, 11 May 2002 17:15:19 -1000
On Saturday, May 11, 2002, at 03:24 , Diggory Laycock wrote:
Hi,
I'm building a document based app (quite similar design to the RaiseMan
example in Hilegass' "Cocoa for Mac OS X" ;-) )
I'm having a bit of a conceptual problem and I was wondering if the
list could help.
I have a Class called AppController that is a delegate of NSApplication
and does certain stuff throughout the life of the app.
I also have a class called MyDocument that controls documents
(obviously!)
I have a control (an NSPopUpButton) in the Document's nib that I would
like to populate from application-specific objects (not document
specifc).
Normally I'd just fire-up IB and make the connections, but the two
objects are in different nibs.
So my question is: How do I send a message from my document to another
object that isn't in the same nib?
If I instantiate my AppController in the Document nib then surely I'd
have far too many AppControllers.
Should I "find" the App controller programatically by sending a message
to NSApplication?
Am I missing something blindingly obvious here? Am I fighting the
system?
I can think of 2 options (there may be others):
First, you can make you AppController object your application's
delegate; then you can always find it using [NSApp delegate].
Second, don't forget that the "FirstResponder" icon can be a control's
target, and that you can add actions to it. If you want a specific
action performed, and no object in the responder chain responds to it,
the chain eventually gets to the application and its delegate object.
_______________________________________________
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.