Loading a nib window and making it key
Loading a nib window and making it key
- Subject: Loading a nib window and making it key
- From: Peter Sichel <email@hidden>
- Date: Mon, 24 Sep 2001 09:42:26 -0400
My last inquiry didn't inspire a response, so I'll try to be
more specific.
I'm loading a window from a nib file and would like it to
appear as the key window so the user can begin typing immediately.
I think I'm using standard techniques:
I've subclassed NSWindowController and include the following init
self = [super initWithWindowNibName:@"Ping"];
From the caller I do
pingWindowController = [[PingWindowController alloc] init];
if (pingWindowController) {
[pingWindowController showWindow:sender];
if (![[pingWindowController window] isKeyWindow]) NSLog(@"Not
key window!");
}
The window appears but is not made the key window until
I click in it, or select the corresponding name
from the Window menu.
The documentation for showWindow (NSWindowController)
or makeKeyAndOrderFront (NSWindow) claim they will make
the window key, but there is obviously some undocumented
dependency because that's not happening. I'm not sure
how to figure out what this might be since I can't see
the sources and the documentation has no such reference.
I could sure use a hint or pointer. What specific steps
or conditions are required to load a nib window and make it key?
Any idea what might prevent it from working?
Obviously the window can be made key since clicking in it
or selecting it from the Window menu works. Why doesn't
makeKeyAndOrderFront (NSWindow) also work when called
immediately after the window is loaded?
Thanks,
- Peter Sichel
--