Re: Close/Minimize the app
Re: Close/Minimize the app
- Subject: Re: Close/Minimize the app
- From: Nick Zitzmann <email@hidden>
- Date: Wed, 11 Nov 2009 21:27:30 -0700
On Nov 11, 2009, at 8:50 PM, Symadept wrote:
> How to close/minimize the app programmatically.
To close the app, call -[NSApplication terminate:].
> I tried the following way
> but no luck.
>
> [[NSApp mainWindow] performMiniaturize:nil];
This will only miniaturize the main window, and it won't work if -mainWindow returns nil (e.g. the app is in the background).
> [OR]
> [NSApp miniaturizeAll:self];
Now that should minimize all of the windows, unless you somehow circumvented loading NSApplication.
> And close should not terminate my app, it should place an icon in the Dock,
> I hope it would be the same. And I know to give Dock Menu items.
>> From that menuitem, if I click on Open, it shall be able to launch my app.
If an app is in the Dock, it is there because the app is running, or because the user wants to keep it in the Dock when it is not running. Please do not programmatically add inactive applications to the Dock. Even if there was an official way of doing this, Mac OS X has a long tradition of making this choice opt-in instead of opt-out like on Windows.
Nick Zitzmann
<http://www.chronosnet.com/>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden