[SOLVED] Re: Newb: Targeting an instance of a class instantiated by a NIB file
[SOLVED] Re: Newb: Targeting an instance of a class instantiated by a NIB file
- Subject: [SOLVED] Re: Newb: Targeting an instance of a class instantiated by a NIB file
- From: Brad Gibbs <email@hidden>
- Date: Mon, 15 Sep 2008 09:31:09 -0700
I had a panel controlled by a window controller that needed access to
code in the main window's window controller. Panels are key windows,
but not main windows. The responder chain rolls up through the
panel's window controller (the key window chain) and then up through
the main window's responder chain, which, in my case, runs up through
the MainWindowController, where the view switching model lives. So,
once I figured out how the responder chain works and how to invoke it
properly, everything worked like a charm.
I can't say this was a fun experience, but the responder chain is
really cool! (and useful).
Thanks to everyone who helped point me in the right direction.
Brad
On Sep 12, 2008, at 8:37 PM, Brad Gibbs wrote:
Hey Jon,
It is a non-document-based app. Only one instance of each window
should ever be open at one time.
I have an AppController class that is the NSApp delegate. In the
AppController's awakeFromNib I alloc the MainWindowController and
initWithNib. In the MainWindowController, I have an IBAction for a
button that allocs the MainMenuWindowController and initWithNib's
the MainMenu (which I'm implementing with a HUD panel and the
BGHUDAppKit).
I'll have to look into putting some references in the AppController.
Brad
On Sep 12, 2008, at 7:52 PM, Jonathan Hess wrote:
Hey Brad -
What code is responsible for creating each of the two window
controllers? Perhaps that code could tell each of the window
controllers about each other. Or, it sounds like your application
isn't document based. Are there ever multiple instances of the two
windows you're currently working with? If not, perhaps your
NSApplication subclass, or application delegate, should have a
reference both window controllers and you could use that object to
be the missing link.
Jon Hess
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden