Re: detecting a double click ahead of time
Re: detecting a double click ahead of time
- Subject: Re: detecting a double click ahead of time
- From: Shaun Wexler <email@hidden>
- Date: Tue, 21 Oct 2003 23:00:16 -0700
On Oct 21, 2003, at 1:58 PM, Robert Miller wrote:
This is probably a basic question but searching the archives didn't
turn up anything. Does anyone know how to determine if there is a
double click pending ? I want to look ahead in the first click
mouseDown to see if there is another leftMouseDown waiting within the
defined double click time. So I guess there are two questions, one is
how do you look for a future click and to how do you find out the
double click speed in Cocoa ?
- (void)mouseDown:(NSEvent *)event
{
NSTimeInterval dblTime = (double)GetDblTime() / 60.0;
NSEvent *nextEvent = [NSApp nextEventMatchingMask:NSLeftMouseDownMask
untilDate:nil inMode:NSDefaultRunLoopMode dequeue:NO];
if (nextEvent && ([nextEvent timestamp] - [event timestamp] <
dblTime)) {
NSLog(@"a possible double-click event is pending...");
}
[super mouseDown:event];
}
Note that nothing in the above method guarantees that the 2nd click is
in close enough proximity to the first mouse loc to be considered a
double-click. Written in mail...
--
Shaun Wexler
MacFOH
http://www.macfoh.com
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.