Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

window won't become main or key programmatically



i have a multi-window (core data) document based cocoa app. one of my windows is not associated with any document, ie, it is a "preference like" window. this window is represented by a nib file. in response to a user menu selection, i instantiate the window via (from within my app delegate):

NSWindowController* wc = [[NSWindowController alloc] initWithWindowNibName: @"prefLike" owner: self];
[[wc window] makeKeyAndOrderFront: self];


the window instantiates fine and displays fine. however, and although it becomes the front window, it doesn't become the main or key window. note however, that clicking on the window will make it main and key without any problem.

i believe this may be because calling [wc window] returns nil, even quite a while later after the window has been made front via a click. i've set a breakpoint at [NSWindowController setWindow] and it is being called.

so, what would cause this problem?

note that calling [wc showWindow] doesn't help.

on a related note, i do have "Visible at Launch Time" checked for the window in IB. however, if i uncheck this, even calling [wc showWindow] doesn't show the window.

i think i'm probably confused about something basic in all this, and will appreciate any guidance.

thanx,
ken
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.