Re: NSWindowContoller communication issues
Re: NSWindowContoller communication issues
- Subject: Re: NSWindowContoller communication issues
- From: Mark Ackerman <email@hidden>
- Date: Wed, 14 Sep 2005 10:39:25 -0400
James,
Perhaps the easiest way for NewRecordController to "know about"
AppController is to have a custom initializer for NewRecordController
in which you pass a reference to AppController.
- (id)initWithAppController:(id)inAppController
{
if (self = [super initWithWindowNibName:@"NewRecordPanel"]
{
// assume "appController" is an instance variable in
NewRecordController
// probably don't need to retain appController, since we'll
assume
// that appController will exist as long as
NewRecordController exists
appController = inAppController;
}
return self;
}
When AppController creates a NewRecordController, it should pass
"self" to NewRecordController's initWithAppController: method.
Once NewRecordController "knows about" AppController,
NewRecordController can call AppController's accessors for the
NSArray that will be used to populate the NSComboBox.
There are other ways to skin this cat, but without knowing more about
how your app operates, this suggestion might help get you started.
Mark
On Sep 13, 2005, at 1:59 PM, James Gifford wrote:
Hello all,
I have what is probably a rather simple problem, but is something I
haven't dealt with yet.
Here is the situation: I have a pretty typical MVC setup with my
main controller "AppController" connecting to my MainMenu.nib.
I've also got a secondary panel in "NewRecordPanel.nib" controlled
by "NewRecordController" which is opened and closed through
AppController. In NewRecordController there is a NSComboBox
object, and I would like to use NewRecordController as the
datasource for it. The thing is, I am maintaining the data I would
like to use to populate the NSComboBox in AppController.
In other words, in AppController there is an NSArray object which
contains the data I would like to use in the NSComboBox which is in
NewRecordController.
So my question is this: how do I use this data from AppController
in NewRecordController? Is there a way to establish communication
between the two controllers? I am not currently using bindings, so
a way to do this without bindings would be most helpful. However,
I'll take all the help I can get in this matter.
Thanks for your help.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40earthlink.net
This email sent to email@hidden
_______________________________________________
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