handle doubleclick without handling click

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
 
H

Herfried K. Wagner [MVP]

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.
 
G

Guest

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top