Re: No double click event available to an NSView?
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