By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,700 Members | 1,441 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,700 IT Pros & Developers. It's quick & easy.

Purging mouse clicks, or flushing the mouse click buffer

P: n/a
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

Jul 16 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Jul 16, 5:01 pm, ImageAnalyst <imageanal...@mailinator.comwrote:
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

Jul 16 '07 #2

P: n/a
On Jul 16, 5:06 pm, Chris Morse <win32...@gmail.comwrote:
On Jul 16, 5:01 pm, ImageAnalyst <imageanal...@mailinator.comwrote:


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- Hide quoted text -

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

Jul 18 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.