• 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: NSWindowController, owner, "primary window"...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSWindowController, owner, "primary window"...


  • Subject: Re: NSWindowController, owner, "primary window"...
  • From: Ken Thomases <email@hidden>
  • Date: Wed, 20 Aug 2008 13:57:52 -0500

On Aug 20, 2008, at 1:39 PM, Gerd Knops wrote:

I have a NSWindowController subclass managing a window and some functionality in that window. Now at some point I need to display a sheet, which is a window in a different nib.

I'd like to use another NSWindowController to load that nib file, mainly so it will take care of (eg release) all the top level objects in that second nib.

The bindings in the second nib need to access objects in my above mentioned NSWindowController subclass, so I'd like that to be the owner. Now when I instantiate the second NSWindowController using 'initWithWindowNibName:owner:', what do I do with the window containing the sheet? I can't hook it up to the file's owner window outlet, as that is already in use for the primary window.

So I basically have no (elegant) way of telling the second window controller what it's window is, or am i missing something? The NSWindowController has this vague notion of "primary window", but doesn't really explain what happens when 'initWithWindowNibName:owner:' is used.

Is there some magic that allows 'initWithWindowNibName:owner:' to figure out what the window is? Or does one have to use 'setWindow:' to set the window when the above initializer is used?

It's very possible that your approach can be made to work. However, at first blush, I'd do it a different way. I'd let the sheet controller be the file's owner of the sheet nib. I'd add a property to the sheet controller class (NSWindowController subclass) which refers back to the master window controller (or its model object graph). Then, I'd bind through that property of file's owner.


Cheers,
Ken

_______________________________________________

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


  • Follow-Ups:
    • Re: NSWindowController, owner, "primary window"...
      • From: Gerd Knops <email@hidden>
References: 
 >NSWindowController, owner, "primary window"... (From: Gerd Knops <email@hidden>)

  • Prev by Date: Animation curve is always linear though specified to be S-like
  • Next by Date: Re: NSWindowController, owner, "primary window"...
  • Previous by thread: NSWindowController, owner, "primary window"...
  • Next by thread: Re: NSWindowController, owner, "primary window"...
  • Index(es):
    • Date
    • Thread