handle doubleclick without handling click

  • Thread starter Thread starter Boni
  • Start date Start date
B

Boni

Dear all,
I am interested in mouse down and double click events of a control.
When doubleclick happens the processing for mouse down should't be done
I did follwing:
sub MyMouseDown(.) handles MouseDown(..)
if e.clicks>1 then return 'This is double click <-----------------(*)
....
end sub
sub DoubleClick(.) handles DoubleClick(..)
end sub

unfortunately when doubleclick happens the simple click seems to happen too.
So (*) don't filter out double clicks.
What is a proper way to handle this problem?
Thanks,
Boni
 
Boni said:
I am interested in mouse down and double click events of a control.
When doubleclick happens the processing for mouse down should't be done
I did follwing:
sub MyMouseDown(.) handles MouseDown(..)
if e.clicks>1 then return 'This is double click <-----------------(*)
...
end sub
sub DoubleClick(.) handles DoubleClick(..)
end sub

unfortunately when doubleclick happens the simple click seems to happen
too.

This behavior is by design. Otherwise it would be impossible to raise the
'Click' event directly after the click is performed by the user.
What is a proper way to handle this problem?

You could check if the time distance between the first and the second click
is greater than 'SystemInformation.DoubleClickTime', and raise the 'Click'
event after the period has elapsed and no consecutive click was performed.
 
For a double click be considered a "double-click", the mouse must be clicked
twice within the System.Information.DoubleClickTime property and within the
System.Information.DoubleClickSize area.

The MouseEventArgs has a property that lets you detect the number of clicks
within these parameters, i.e., MouseEventArgs.Clicks.
 
Back
Top