• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSWindowContoller communication issues
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
References: 
 >NSWindowContoller communication issues (From: James Gifford <email@hidden>)

  • Prev by Date: Re: null selector
  • Next by Date: RE: Cocoa Controls
  • Previous by thread: Re: NSWindowContoller communication issues
  • Next by thread: Re: NSWindowContoller communication issues
  • Index(es):
    • Date
    • Thread