Re: Proper way to load child Window/Controller?
Re: Proper way to load child Window/Controller?
- Subject: Re: Proper way to load child Window/Controller?
- From: Timothy Klein <email@hidden>
- Date: Tue, 10 Jul 2007 12:12:27 -0600
On 9 Jul 2007, at 3:34 PM, Jason Sallis wrote:
I'm working on my first semi-real Cocoa app and am having a
problem. The
app that runs as a Status Item with a menu which loads a main
window. From
that window, I want to spawn child windows. What I currently have
happening
is when the user clicks a button in the main window, I call a
method which
has the following code to show the Preferences window:
[ snip ]
This worked fine up until now when I need to access a table control
from the
Preferences window in my PreferencesController object. Since my
controller
was created outside the nib instead of being baked in, I have no
outlet set
to access the table.
Is this a document-based application? I have a document-based
application that has a main window, and a couple of sub-windows. In
the NIB files in Interface Builder, I set my "File's Owner" to have a
custom class, which is my subclass of NSWindowController*. I put
outlets there, which is how my controller gets at it's window and
vice versa. ( I had to override -makeWindowControllers: to create my
3 custom window controller objects in the document class. The
NSDocument class has a method to let you get at its window controllers).
If I'm understanding your setup, I think something like this might work.
If your app is not document-based, it works a bit differently, and
I'm fuzzy on what the procedure is right now.
Timothy Klein
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