• 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: Preventing Opening a New Document When Clicking Active Program in Dock
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Preventing Opening a New Document When Clicking Active Program in Dock


  • Subject: RE: Preventing Opening a New Document When Clicking Active Program in Dock
  • From: "Christopher Hickman" <email@hidden>
  • Date: Fri, 2 Sep 2005 17:06:45 -0400

Your application delegate should implement
applicationShouldHandleReopen:hasVisibleWindows:

>From the docs:

- (BOOL)applicationShouldHandleReopen:(NSApplication *)theApplication
hasVisibleWindows:(BOOL)flag

Sent by theApplication to the delegate prior to default behavior to reopen
(rapp) AppleEvents. These events are sent whenever the Finder reactivates an
already running application because someone double-clicked it again or used
the dock to activate it. By default the Application Kit will handle this
event by checking whether there are any visible NSWindows (not NSPanels),
and, if there are none, it goes through the standard untitled document
creation (the same as it does if theApplication is launched without any
document to open). For most document-based applications, an untitled
document will be created. The application delegate will also get a chance to
respond to the normal untitled document delegations.If you implement this
method in your application delegate, it will be called before any of the
default behavior happens. If you return YES, then NSApplication will go on
to do its normal thing. If you return NO, then NSApplication will do
nothing. So, you can either implement this method, do nothing, and return NO
if you do not want anything to happen at all (not recommended), or you can
implement this method, handle the event yourself in some custom way, and
return NO.
flag indicates whether NSApplication has found any visible NSWindows in your
application. flag can be used as an indication of whether NSApplication
would do anything if you return YES.

Note that what happens to minimized windows is not determined yet, but the
intent is that flag being NO indicates whether the Application Kit will
create a new window to satisfy the reopen event.


-----Original Message-----
From: cocoa-dev-bounces+tophu=email@hidden
[mailto:cocoa-dev-bounces+tophu=email@hidden] On Behalf Of Kirt
Cathey
Sent: Friday, September 02, 2005 4:56 PM
To: email@hidden
Subject: Preventing Opening a New Document When Clicking Active Program in
Dock

Hi All.

I have noticed that some applications, including the one I am developing,
automatically open a new document when the user clicks an active
application icon in launcher. How can we pevent this from happening? In
other words, when the dock icon is clicked, instead of opening a new
document, just to bring the application most forward and active.

Regards,
-------------------------
Kirt S. Cathey
http://www.bizolutions.com
-------------------------

_________________________________________________________________
ウィルス駆除も無料の 「MSN Hotmail」  http://www.hotmail.com/

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Preventing Opening a New Document When Clicking Active Program in Dock (From: "Kirt Cathey" <email@hidden>)

  • Prev by Date: Re: dyld CoreData failure on 10.3 Systems (Gracefully failing on unsupported OS version)
  • Next by Date: Re: Embedding a framework...
  • Previous by thread: Preventing Opening a New Document When Clicking Active Program in Dock
  • Next by thread: Re: Preventing Opening a New Document When Clicking Active Program in Dock
  • Index(es):
    • Date
    • Thread