Mailing Lists: Apple Mailing Lists

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

windowDidBecomeMain when app being made active



I have the following code in a window delegate:

- (void) windowDidBecomeMain:(NSNotification *) notification
{
NSWindow *window = [NSApp mainWindow];
DEBUG_ASSERT( window != nil );
}

This code works fine if I switch among windows in my application. However, if I switch to a different app, then switch back, the assertion fires because [NSApp mainWindow] is returning nil. Why is this? If the window "did" become main, shouldn't I get back my window? This happens no matter how I switch back into my app. Clicking a window, the dock icon, etc. Any ideas?

-jim
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.



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.