MouseUp and DoubleClick

  • Thread starter Thread starter Sue & Bill
  • Start date Start date
S

Sue & Bill

Does a double click action also generate two MouseUp events?

If so, what is a good method in my MouseUp event handler to detect that
a MouseUp is part of a double click action?

Thanks in advance.
 
If by double click action you mean having the mouse button be clicked twice
on a given control in order to cause a double click, then yes, two MouseUp
events would end up being fired.

My best suggestion would be to limit the work done on a MouseUp event so
that if fired it does not interfere with a possible later DoubleClick event.

Brendan
 
I am doing graphics and can't avoid handling MouseDown and MouseUp.
How do people manage in such circumstances? That is, how can I tell
that a MouseUp is part of a double click and should be ignored?

Thanks
 
Try with the timer function.

I test and get this miliseconds marks
in a single click
down event 35937.86
up event 35938
click event 35938

in a double click
down 35938.97
up 35939.06
click 35939.06
db 35939.16
up 35939.27

you can check the miliseconds marks between events and discards when
need it.

Sorry for my english.
Regards
 
I agree with Roer, some sort of timing or flag method is really your only
choice because you could not have a DoubleClick event cancel a previously
fired event.

One method might be to setup a timer that triggers the MouseUp event to
complete (after being initially fired) some interval after it was actually
triggered, only if a flag remains set, a flag that is altered when the
DoubleClick event is fired.

Brendan
 
Thanks all. I have done that. Now, any tips on how to retrieve that
double click interval setting from Windows?
 
Hard to find, but here is
Declare Function GetDoubleClickTime Lib "user32.dll" () As Long

Private Sub Command1_Click()
Dim doubletime As Long
doubletime = GetDoubleClickTime()
Text1 = Str(doubletime) + " Millisecond(s)"
End Sub

Founded at http://www.vbcode.com/Asp/showsn.asp?theID=6126
Thanks to Author: Ayan Chaudhuri
 
Back
Top