Graham, I followed your advice.  However, there just one minor hitch.

I neglected to emphasize that I want the main window to be invisible until the startup processing finished. At that time I would remove the startup window and display the main window. To this end, I unchecked the 'Visible at Launch' checkbox for my main window in my NIB. So, when my app starts, the main window is not seen. In my - [applicationDidFinishLaunching] method, I load the startup window's controller and NIB file and display the startup window. When the startup processing is finished, I close the startup window and release the controller. Here is where things go south.

-[[NSApplication sharedApplication] mainWindow] returns nil! So, when I call -[window makeKeyAndOrderFront] I'm doing so with a nil object. I don't know how to make my main window visible. From what I could tell the mainWindow property of the NSApplication will be nil if the app is hidden. When I call -[NSApplication isHidden] it returns FALSE. So, I would expect the associated window to be available. By unchecking the 'Visible at Launch' checkbox I've don't seem to have a method for displaying my main window.

I need the help of someone who understands more about initialization from the NIB and how all this stuff fits together so they can instruct me as to how to display my main window without re-structuring my app.

-Michael

On Sep 2, 2009, at 11:41 AM, Graham Cox wrote:


On 03/09/2009, at 1:28 AM, Michael A. Crawford wrote:

Anyway, I thought of changing the structure of my app so that the main nib displays the startup and then loads what used to be my main nib with my primary view, menu, etc. I'm not experienced enough with AppKit to know whether or not that is a good approach.


Just add a startup panel and, if there is one, a controller for it to your main nib. You'd probably want to hook it into your app delegate so it can be taken down when launching finishes. There's nothing to stop you having multiple windows in a single nib, and in this case that would definitely be the simplest thing.

--Graham



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to