Purging mouse clicks, or flushing the mouse click buffer

I

ImageAnalyst

Does anyone know how to get rid of excess mouse clicks? I have a
button that does some code which takes some time to execute. As soon
as the user clicks the button, I disable the button in the button
handler and enable it again when I exit the handler. However, if the
user clicks a bunch of times, say 10, during the time it's disabled
and executing for the first time, it will start to process the second
mouse click the moment the button gets enabled again. So basically,
if the code takes 5 seconds to execute and the user clicks 10 times
during that 5 seconds, then there will be another 10 runnings of that
code (50 seconds more to process the duplicate clicks). I really only
wanted to have the user run it once, until it gets enabled again and
they can properly click on it again. My idea is to completely get rid
of any queued up mouse clicks when I exit the button handler code (but
I don't know how to do that).

Any ideas on how to prevent multiple excess mouse clicks (since
disabling the button didn't work)?
Thanks,
ImageAnalyst
 
C

Chris Morse

Does anyone know how to get rid of excess mouse clicks? I have a
button that does some code which takes some time to execute. As soon
as the user clicks the button, I disable the button in the button
handler and enable it again when I exit the handler. However, if the
user clicks a bunch of times, say 10, during the time it's disabled
and executing for the first time, it will start to process the second
mouse click the moment the button gets enabled again. So basically,
if the code takes 5 seconds to execute and the user clicks 10 times
during that 5 seconds, then there will be another 10 runnings of that
code (50 seconds more to process the duplicate clicks). I really only
wanted to have the user run it once, until it gets enabled again and
they can properly click on it again. My idea is to completely get rid
of any queued up mouse clicks when I exit the button handler code (but
I don't know how to do that).

Any ideas on how to prevent multiple excess mouse clicks (since
disabling the button didn't work)?
Thanks,
ImageAnalyst

Try adding an Application.DoEvents() - the disabled button should eat
the clicks.

// CHRIS
 
I

ImageAnalyst

Try adding an Application.DoEvents() - the disabled button should eat
the clicks.

// CHRIS- Hide quoted text -

- Show quoted text -

Thanks Chris. This should probably acomplish the desired effect.
I'll give it a try tomorrow.
Regards,
ImageAnalyst
 

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