
FB II Compiler
PG PRO
Debugging
Memory
System
Mathematics
Resources
Disk I/O
Windows
Controls
Menus
Mouse
Keyboard
Text
Fonts
Drawing
Sound
Clipboard
Printing
Communication
ASM
|
MOUSE
Detect double clicks
You've got half of it done. Here's all you need to do to make it work:
Make two globals:
gLastWhen&
gLastWhere&
On _every_ click, call a routine that does the following:
1) set a flag to _false - this is the default, saying that a double-click has not occured.
2) compare the current TickCount with the TickCount stored in gLastWhen&. If they are within FN GetDblTime ticks of each other, then go on to #3, otherwise exit.
3) compare the mouse position at the time of the click with the one stored in gLastWhere&. If they are within 5 pixels in both directions, then go on to #4, otherwise go to step 5.
4) set the flag to _true - this is a double click
5) store the current position in gLastWhere&.
6) store the current TickCount in gLastWhen&.
7) return the flag (true or false).
Call this routine before you do _anything_ else - so that before you do your normal mouse click handling, you know whether it was a double click or not. That's all there is to it. :-)
|