Re: [Pyobjc-dev] How to get NSDoc subclass's window outlet?
Brought to you by:
ronaldoussoren
From: <bb...@ma...> - 2002-12-15 18:12:35
|
Oh! You are absolutely correct. I apologize -- I didn't read the docs correctly. It doesn't work because it shouldn't. :-) > self.windowControllers()[0].window() works though. Is the correct way to go about it, ugly though it is. However, if you need direct access to the window, it is likely that there is an alternative design pattern that may be a bit more clean. b.bum On Sunday, Dec 15, 2002, at 12:41 US/Eastern, David Eppstein wrote: > On 12/15/02 9:32 AM -0500 bb...@ma... wrote: >> Generally, you never should or need to access an instance variable of >> AppKit classes directly, even when subclassing. An accessor method is >> almost always provided. >> >> In this case, NSDocument implements the -window method for exactly >> this >> purpose. >> >> Try self.window(). >> >> If that doesn't work, then there is a bug. > > It doesn't work. exception: No attribute window > window() is also not documented in the AppKit API reference although > setWindow:() is there (with a note saying don't call it). > |