• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: [NSApp mainWindow] weirdness
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [NSApp mainWindow] weirdness


  • Subject: Re: [NSApp mainWindow] weirdness
  • From: email@hidden (Simon Fraser)
  • Date: Mon, 01 Jul 2002 20:20:00 -0700

Shawn Erickson wrote:

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.

applicationDidFinishLaunching is exactly the place where
[NSApp mainWindow] is lying to me. I've also seen [NSApp mainWindow]
return null when handling Apple Events (oddly, from just some Carbon
apps) long after startup.

Simon
_______________________________________________
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.

  • Follow-Ups:
    • Re: [NSApp mainWindow] weirdness
      • From: Shawn Erickson <email@hidden>
References: 
 >Re: [NSApp mainWindow] weirdness (From: Shawn Erickson <email@hidden>)

  • Prev by Date: Re: [NSApp mainWindow] weirdness
  • Next by Date: Re: Cocoa stripping resource forks: does Jaguar fix?
  • Previous by thread: Re: [NSApp mainWindow] weirdness
  • Next by thread: Re: [NSApp mainWindow] weirdness
  • Index(es):
    • Date
    • Thread