StillDown
StillDown
See if the button stayed down after it was last pressed returns Is button still down since last mouseDown?
StillDown checks if the mouse button has been continuously pressed since the most recent mouseDown event.
Returns: a Boolean value reporting activity since the most recent mouseDown. It is one of:
FALSE button is up or there are one or more mouse events pending in the queue. It is not "still down".
TRUE button is down and it has not been released since the most recent mouseDown. It is "still down".
Notes: StillDown is normally called directly after detecting a mouseDown event being dragged. To process the dragging, call WaitMouseUp repeatedly in a loop; e.g.:
switch ( theEvent.what ) {
case mouseDown:
oldPt=newPt;
}
}
}
else {
/*... process normal (non-dragging) mouseDown . . .*/
}
break;
case keyDown:
/* etc */
The advantage of testing the loop via WaitMouseUp rather than StillDown is that it removes the mouseUp event from the queue and simplifies checking for double clicks (see GetDblTime). You can also test the state of the button via Button, but that function does not indicate whether the button has been released and pressed between calls.