• 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: How to launch window of the application on clicking of dock icon?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to launch window of the application on clicking of dock icon?


  • Subject: Re: How to launch window of the application on clicking of dock icon?
  • From: Ömer Kardaş <email@hidden>
  • Date: Thu, 11 Dec 2008 00:47:37 +0200

You can also use -windowShouldClose event and simply hide your application instead of closing the window. Clicking on the dockicon will simply show it.

- (BOOL)windowShouldClose:(id)window {
	[[NSApplication sharedApplication] hide:self];
	return NO;
}

On Dec 10, 2008, at 7:49 AM, Arun wrote:

Thanks for the reply.

My app is not a document based.
I tried using the applicationDidBecomeActive to bring up my main window. It
works only when my application is not active. i.e., when the MenuBar is
occupied by other application. If i launch my app and close the window, the
menu bar is still occupied with My App's menu bar. If noe i click on the
dock icon, the window will not come up. I need the window to come up.


-Arun KA



On Wed, Dec 10, 2008 at 12:21 AM, Raleigh Ledet <email@hidden> wrote:

This depends on your application.

A document based application will automatically create a new untitled
document for you. Which is generally what you want. If you app is really
document based, its best to use the document based project template.


If you app is not document based (say Mail or System preferences) then you
have to consider what the expected / correct behavior is. Mail stays active
when you close all of it's windows (checking email in the background). For
this behavior use -applicationDidBecomeActive: to check if any widows are
shown. If not, then show the expected window.


For some (rare) apps on OS X, staying open is not expected / wanted. For
example, System Preferences quits when you close its one and only window.
This can be done via - applicationShouldTerminateAfterLastWindowClosed.


If this is just a test app, you might want to try them all to get a feel
for it. But for a real app, consider very carefully which behavior you want.


-raleigh


On 09 Dec,2008, at 9:02 AM, Arun wrote:

Hi,

I have created a simple application in cocoa.
when it is ran, the main window appears and a default dock icon in the
Dock.
If i close the window, the dock icon still stays. But if i click on the
dock
icon then also the main window is visible.
The only way i can see the main window is by quitting the app and
launching
it again. Is there any way in which upon clicking on the dock,
the application window becomes visible.


Thanks
Arun KA
_______________________________________________

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



_______________________________________________

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

_______________________________________________

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


References: 
 >How to launch window of the application on clicking of dock icon? (From: Arun <email@hidden>)
 >Re: How to launch window of the application on clicking of dock icon? (From: Raleigh Ledet <email@hidden>)
 >Re: How to launch window of the application on clicking of dock icon? (From: Arun <email@hidden>)

  • Prev by Date: Re: Newbie. Creating SubViews that aren't associated with NSWindow, or NSPanel?
  • Next by Date: Re: Problem drawing outside of drawRect: in a custom table cell
  • Previous by thread: Re: How to launch window of the application on clicking of dock icon?
  • Next by thread: Accessing NSKeyedArchiver's archivedDataWithRootObject by name
  • Index(es):
    • Date
    • Thread