Re: WindowController


Jon Gotow
 

Is the 'window' outlet of the XIB file's owner set to point to the window in the XIB? It doesn't sound like it.

- Jon

On Jul 17, 2017, at 3:44 PM, Gerriet M. Denkmann <g@...> wrote:


On 18 Jul 2017, at 04:18, Quincey Morris <quinceymorris@...> wrote:

On Jul 17, 2017, at 14:08 , Gerriet M. Denkmann <g@...> wrote:

It never has. Even after the first time where showWindow will succeed.
This is — in some sense — impossible. There is a window. (You can see it.) Either the debugger is lying to you, or the window is unrelated to the window controller. Whichever it is, it’s worth investigating further.
if ( self.prefController == nil )
{
self.prefController = [ [ NSWindowController alloc ] initWithWindowNibName: @"PrefWindow" ];
NSLog(@"%s prefController %@",__FUNCTION__, self.prefController);
};

[ self.prefController showWindow: self ];
NSLog(@“%s window %@“,__FUNCTION__, self.prefController.window);

prints prefController once
window = nil always


BTW, in your XIB file for the preferences window, did you leave “Visible at launch” checked? It shouldn’t be, if you’re using a window controller, but OTOH I can’t see it having this result if you did.
Without “Visible At Launch” I never see a window - not even the first time.

Kind regards,

Gerriet.




Join {cocoa@apple-dev.groups.io to automatically receive all group messages.