GetDblTime
GetDblTime Find max delay between clicks of a double click returns suggested time between clicks
GetDblTime returns an interval of time, in ticks. If two mouseDown events occur within this interval and are close together, the combined events should
be considered a double click.
Returns: a 32-bit long; the suggested maximum interval, in 1/60th-second ticks, between a mouse up and the following mouseDown, that should
constitute a double click.
Notes: Another way to get this information is to access the global variable
DoubleTime directly. The interval is adjustable by the user via the
Control Panel DA.
two mouseDown events and the second is less than DoubleTime ticks older
than the first and the points of occurrence are within 5 pixels, it should be
considered a double click. The following example illustrates how to detect a
double click.
Example
#include <Events.h>
#include
long lastWhen = 0;
if ( theEvent.what == mouseDown ) {
if ( ( ( theEvent.when - lastWhen) < DoubleTime )
&& ( abs( theEvent.where.h-lastWhere.h) < 5 )
&& ( abs( theEvent.where.v-lastWhere.v) < 5 ) ) {
DoDoubleClick( &theEvent ); // process the double click
}
lastWhen = theEvent.when;
lastWhere = theEvent.where;
/* ... handle other mouseDown events ... */
}
if ( theEvent.what == keyDown) {
/* ... etc ...*/
}
}