Mailing Lists: Apple Mailing Lists

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

closing window and having application remain running



Hello,

I have an application that I want to allow users to close the main
window and have the application continue running. I've implemented the
following code in the NSApplication delegate and it works, my question
is: is this the right way to do it?

- (BOOL) applicationOpenUntitledFile:(NSApplication *)app
{
	NSWindow* mainWindow = [[app windows] objectAtIndex:0];
	
	[mainWindow makeKeyAndOrderFront: self];
	
	return YES;
}

Is the main window always going to be at index 0? Is there a better
way to get at the main window? I tried [app mainWindow] but that did
not seem to work.

By the way, this is for an open-source rewritable media blanking
program available at http://megablanker.sourceforge.net if anyone is
interested.

Thank you,

Tyler Riddle

--
Quote: "You need only reflect that one of the best ways to get
yourself a reputation as a dangerous citizen these days is to go about
repeating the very phrases which our founding fathers used in the
struggle for independence."--Charles Austin Beard
Web site: http://tylerriddle.com
AIM: The Masta Spice
_______________________________________________
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.