Re: NSDocument and window ivar
Re: NSDocument and window ivar
- Subject: Re: NSDocument and window ivar
- From: Andy Lee <email@hidden>
- Date: Sun, 27 Jul 2008 23:02:15 -0400
On Jul 27, 2008, at 10:26 PM, Todd Heberlein wrote:
In the documentation for NSDocument there is a method called -
(void)setWindow:(NSWindow*)aWindow, for which aWindow is described
as "The window to which the receiver’s window outlet points."
Furthermore, if I ctrl-click on the File's Owner in MyDocument.xib
(a document-based app), which is of class MyDocument (subclass of
NSDocument), it *does* show the window outlet there and it *does*
show it pointing to the window.
But I cannot pass messages to the window variable. For example, I
cannot send it the "setTitle:" message.
Looking at the header file, I see that the instance variable in
NSDocument is actually called _window, and furthermore it is @private,
so you can't refer to it directly in your subclass.
I suppose you could use something sneaky like valueForKey:@"window",
but I would recommend using published API instead. I don't know
anything about NSDocument, but the -windowForSheet method that Alex
suggested looks right.
--Andy
_______________________________________________
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