Hi,

I have fixed my problem of miniaturizing the window. It was quite cool.

NSApplication *application = [NSApplication sharedApplication];
NSWindow *keyWindow = [application keyWindow];
[keyWindow miniaturize:keyWindow];

My app has KeyWindow but not MainWindow, because my app's window is
NSBorderlessWindowMask.

Thanks alot all of you for great effort.

Regards
Mustafa

On Thu, Nov 12, 2009 at 1:23 PM, kirankumar <kiran.kod...@moschip.com>wrote:

>  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 <n...@chronosnet.com>
> 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 (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/kiran.koduri%40moschip.com
>
>  This email sent to kiran.kod...@moschip.com
>
>
>
> ------------------------------
> 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 (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