On 16 Sep 2008, at 1:44 pm, Chris Idou wrote:

That fixes it, but I thought the owner in this case was the owner of the NSWindowController, not the File's owner of the NIB.

-initWithWindowNibName:owner: expects you to pass the object that is represented by File's Owner in the NIB. Typically this is the window controller itself (in which case you can just use - initWithWindowNibName:, which implicitly passes 'self' as owner) but it need not be - it could be the document for example (personally I think this usage is probably unusual). The point is you have to be consistent - if you set up the NIB as if File's Owner is the controller, but then pass a document or some other object as the owner, there's a mismatch between your NIB and your code. Something's going to give ;-)

NSWindowController has an "owner" property. But if you're saying the owner is the File's owner, which is the NSWindowController itself, then what is the owner property for?

If you design your nib with some other object in mind as File's Owner, this object is returned by -owner. As I said I think it's unusual to do this, but you may have a hierarchy of controllers where you'd prefer them all to be managed by some common central object for example. There may be other situations but I've never used it this way so I don't know what they are. I suspect it would hinder the reuse of your controller/nib elsewhere though they aren't often all that reusable anyway.

cheers, Graham



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to