• 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: Clicking dock icon opens window
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Clicking dock icon opens window


  • Subject: Re: Clicking dock icon opens window
  • From: Eric Peyton <email@hidden>
  • Date: Wed, 21 Nov 2001 08:51:50 -0600

Or - it may be just a lot easier to handle this delegate message that is designed exactly for this ...

- (BOOL)applicationShouldHandleReopen:(NSApplication *)sender hasVisibleWindows:(BOOL)flag;

According to the docs (NSApplication) ...

"These events are sent whenever 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, this means 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."

I have no idea why you couldn't find it by searching the docs.

Eric

On Wednesday, November 21, 2001, at 05:25 AM, Marc Laffitte wrote:

On mercredi, novembre 21, 2001, at 07:44 , Mario Diana wrote:

Assuming there are no open windows in your application, clicking the application's icon in the dock is supposed to open a window. How does one implement this? The app I built from the "Simple Text Editor" project from Mike Beam at O'Reilly did it, but I can't figure out how.

The application I'm working on is not document based. It has only one window and some alert panels. I figured out how to implement the "New" command from the File menu, but this is vexing me.

For the life of me, I cannot figure this out by myself. I knocked around in Interface Builder for a good, long time. I searched the documentation, the ADC, and the list's archives, and for all I know I read right over it. But, I tried -- I swear!



Hi!
Clicking on an application's icon in the dock either launches it or makes it the front application if it is allready launched. This is not directly an order to open a window. You may or may not open a window if it is appropriate for you in such cases.
You can look at NSApplication.h and use a notification like applicationDidBecomeActive: in order to know when to open a window.

Marc
_______________________________________________
cocoa-dev mailing list
email@hidden
http://www.lists.apple.com/mailman/listinfo/cocoa-dev


References: 
 >Re: Clicking dock icon opens window (From: Marc Laffitte <email@hidden>)

  • Prev by Date: Re: NSTask interaction
  • Next by Date: Re: CD format
  • Previous by thread: Re: Clicking dock icon opens window
  • Next by thread: Cocoa & UNIX
  • Index(es):
    • Date
    • Thread