Re: detecting long(ish) mouseDown?
Re: detecting long(ish) mouseDown?
- Subject: Re: detecting long(ish) mouseDown?
- From: John Stiles <email@hidden>
- Date: Mon, 22 Mar 2004 17:22:11 -0800
On Mar 19, 2004, at 3:01 PM, Allan Odgaard wrote:
On 19. Mar 2004, at 21:08, Jeff wrote:
The general question is, how to i detect a "the mouse was held down
and not moved for x-seconds" event?
In mouse down: set a timer to fire which sets an ivar.
In mouse dragged and mouse up: cancel the timer (if it hasn't fired).
Then in mouse dragged you can just check the ivar to see wether you
should select or drag.
I use 0.15 seconds as the delay, found by experimenting -- if anyone
knows the system value, please let me know.
I believe the system value is the same as the double-click time, but I
am not 100% sure.
GetDblTime (from the Carbon framework) is one way to get the
double-click time (in 60ths of a second). There may be a separate
AppKit/Objective-C way, but I don't know it, and the results won't be
any different anyway :)
You can also just store the time when you received mouse down and
check it against the time in mouse dragged -- I use the NSTimer
because I change the pointer after the delay (which is highly
recommended).
_______________________________________________
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.
_______________________________________________
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.