Re: WindowController


Gerriet M. Denkmann
 

On 18 Jul 2017, at 04:55, Jon Gotow <gotow@stclairsoft.com> wrote:

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.
Indeed it was not. After connecting it as it should have been, now all works perfectly as expected.
Thanks a lot for this brilliant idea!

This brings up another question:
I seem to remember that once Xcode allowed me to create a window + window-controller together (with all connections nicely set).
Today I could not found this (Xcode 8.3.3).
Can this be done; if yes: then how?




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


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

On Jul 17, 2017, at 14:08 , Gerriet M. Denkmann <g@mdenkmann.de> 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.