Re: [NSApp mainWindow] weirdness
Re: [NSApp mainWindow] weirdness
- Subject: Re: [NSApp mainWindow] weirdness
- From: Shawn Erickson <email@hidden>
- Date: Mon, 1 Jul 2002 20:12:59 -0700
On Monday, July 1, 2002, at 07:34 PM, Simon Fraser wrote:
When does NSApplication set up its 'mainWindow'? I'm seeing cases
where we've got a window on the screen, but [NSApp mainWindow] is
still returning null (this is often at application startup time).
Some time later, [NSApp mainWindow] will correctly return this window.
Does [NSApp mainWindow] only get set after we've been back through
the main event loop after creating the window? Or is there some
other timing wierdness involved?
From the docs for mainWindow...
"Returns the main window. This method returns nil if there is no main
window, if the application's nib file hasn't finished loading, if the
main window belongs to another application, or if the application is
hidden."
In this case it sounds like you are attempting to access the main window
before nib has finished loading.
In your apps delegate implement
applicationDidFinishLaunching:(NSNotification*) to know when your app is
fully loaded so you can do an final initialization needed.
-Shawn
_______________________________________________
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.