• 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: No double click event available to an NSView?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: No double click event available to an NSView?


  • Subject: Re: No double click event available to an NSView?
  • From: Scott Stevenson <email@hidden>
  • Date: Sun, 4 Feb 2007 17:57:00 -0800


On Feb 4, 2007, at 4:47 PM, Ken Tozier wrote:

If a custom NSView subclass needs to respond in different ways to both single clicks and double clicks, you need to start with the assumption that all mouse downs are the first click of a double click. In the event the second click doesn't arrive in the defined double-click time, you need to set up an NSTimer with the selector of a single click handler. If a second click does arrive within the double click interval pass the event to a double click handler.

For whatever it's worth, this has worked reliably for me:

 if ([event clickCount] > 1) {
	// do something
} else {
	// do something else
}

Maybe it depends on what you're trying to do.

In any case, I'm not sure you want to setup your own timer since System Preferences allows the user to set a global double-click speed. A person may be surprised if that differs in one application.

    - Scott
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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: No double click event available to an NSView?
      • From: Uli Kusterer <email@hidden>
References: 
 >No double click event available to an NSView? (From: Ken Tozier <email@hidden>)
 >Re: No double click event available to an NSView? (From: Ricky Sharp <email@hidden>)
 >Re: No double click event available to an NSView? (From: Ken Tozier <email@hidden>)

  • Prev by Date: Re: NSString inaccurate Hash
  • Next by Date: Re: menu titles change between IB and running the app...
  • Previous by thread: Re: No double click event available to an NSView?
  • Next by thread: Re: No double click event available to an NSView?
  • Index(es):
    • Date
    • Thread