I don't use any timers, I just remember the "ticks" from the last click,
and compare it to the current click "ticks" to find out what the gap
between clicks are. Then if they are < the system double click time, I
treat it like a double-click.
If you only need this in the "mouseUp" event, for instance, you can
easily use a static variable:
Static lastDoubleClickTime As Integer
If Ticks - lastDoubleClickTime < SystemDoubleClickTime() Then
MsgBox "It is a double click"
Else
lastDoubleClickTime = Ticks
End
I think that works, and it is pretty much what I do. Of course, if you
must use this in more than one method, it wouldn't hurt to make the
lastDoubleClickTime as a property of something such as the window or
custom class.
Try it, place that in the MouseDown event of a window and see that it
works pretty well. See the quoted message below for the declaration of
the SystemDoubleClickTime function.
- Ryan Dary
RBNUBE wrote:
I think you would have to set up a timer that will detect clicks and
determine if they should be treated as single clicks or double clicks based
on how far apart the clicks occurred. I think this is done by counting
ticks.
I received the code below to get the double-click times for different
systems. I ended up using SystemDoubleClickTime = 8 because, interestingly
enough, it felt more accurate.
SystemDoubleClickTime as Integer is a property that was added to a timer.
#If TargetPPC
Declare Function GetDblTime Lib "CarbonLib" () as Integer
SystemDoubleClickTime = GetDblTime()
#EndIf
#If TargetMacOS
Declare Function GetDblTime Lib "InterfaceLib" () as Integer
SystemDoubleClickTime = GetDblTime()
#EndIf
#If TargetWin32
Declare Function GetDoubleClickTime Lib "User32.DLL" () as Integer
SystemDoubleClickTime = GetDoubleClickTime()
'SystemDoubleClickTime = 8
#EndIf
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>