• 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: Close/Minimize the app
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Close/Minimize the app


  • Subject: Re: Close/Minimize the app
  • From: kirankumar <email@hidden>
  • Date: Thu, 12 Nov 2009 10:53:03 +0530

hi,


this will help you keep this 3lines of code in awakeFromNib, and mpwindow is you are window name.


id closeButton = [mpWindow standardWindowButton:NSWindowCloseButton ]; [closeButton setAction:@selector(closeapp:)]; [closeButton setTarget:self];



- (IBAction)closeapp:(id)sender
{
 exit(0);
}

Regards,
kiran
On Nov 12, 2009, at 10:18 AM, Symadept wrote:

Actually I wanted to hide the app when close button is closed such that it
shall be active still. Which I was doing. I was basically facing the problem
with Minimize the app. I don't know why the NSApp
miniaturizeAll:self<http://discussions.apple.com/>;
is not functioning as expected.

Regards
Symadept


On Thu, Nov 12, 2009 at 12:27 PM, Nick Zitzmann <email@hidden<mailto:email@hidden>> wrote:


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<mailto: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<mailto:email@hidden>


________________________________ The information contained in this email and any attachments is confidential and may be subject to copyright or other intellectual property protection. If you are not the intended recipient, you are not authorized to use or disclose this information, and we request that you notify us by reply mail or telephone and delete the original message from your mail system. _______________________________________________

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


  • Follow-Ups:
    • Re: Close/Minimize the app
      • From: Andrew Farmer <email@hidden>
    • Re: Close/Minimize the app
      • From: Symadept <email@hidden>
References: 
 >Close/Minimize the app (From: Symadept <email@hidden>)
 >Re: Close/Minimize the app (From: Nick Zitzmann <email@hidden>)
 >Re: Close/Minimize the app (From: Symadept <email@hidden>)

  • Prev by Date: Stack-based C++ class to wrap NSAutoreleasePool
  • Next by Date: Building a tree
  • Previous by thread: Re: Close/Minimize the app
  • Next by thread: Re: Close/Minimize the app
  • Index(es):
    • Date
    • Thread