By Edhy Rijo - 11/18/2010
Hi guys,
I am having a situation where some users are double clicking a command button and its Click() event is being fired twice, is there a way to prevent this?
I have done some research in Google but could not find an easy solution, other than creating a timer to handle the click.
Thanks!
|
By Ivan George Borges - 11/18/2010
Hi Edhy.
Would disable the button once it enters the Click event work? And then Enable it back once you finish everything you want to do inside it?
|
By Edhy Rijo - 11/18/2010
Hi Ivan,
Thanks for the prompt response. Yes that does the trick even though it is weird that a double click action would be registered twice. This mean that now I would have to re-test all my buttons or create a subclass to do the enable/disable trick.
Is this also happening to you?
|
By Ivan George Borges - 11/18/2010
Nope, never thought of it. But it does make sense it runs twice, since the user clicked the thing twice.
I think we could put a message "Can you please give the application some time to do its job?!" to the user, and of course, use the Localization and Messaging Editor to create a key to this message, so we do it in all languages possible.
|
By Edhy Rijo - 11/19/2010
Well, you should have seen my face when I got the call from the user reporting that my process was running twice
At least I have only get one call on this specific process, so for now fixing this button will be enough. Hmmm, never got that complaint using Visual FoxPro but did get others
|
By Russell Scott Brown - 11/19/2010
Hello Edhy.
I know if FoxPro I often run into problems with people, especially older ones, double-clicking on command buttons like crazy for some reason. Also have the issue where they do 2 single-clicks instead of 1 double-click because they are mouse challenged.
Anyway, this workaround is good to know. Thanks
|
By Edhy Rijo - 11/19/2010
Russell Scott Brown (11/19/2010) I know if FoxPro I often run into problems with people, especially older ones, double-clicking on command buttons like crazy for some reason. Also have the issue where they do 2 single-clicks instead of 1 double-click because they are mouse challenged. Hi Russell,
That is good to know, but I did reproduced the issue with a very fast double click and was surprised to see my process running twice.
|
By Ivan George Borges - 11/19/2010
Now that I gave it some more thinking, I do have some buttons that start long processing that I disable as soon as they get clicked... and not only them, many of the form controls that are waiting for a click, so the user won't get a chance to mess it up.
|
By Greg McGuffey - 11/19/2010
Here's some info on how the click/double-click events play together: Control.DoubleClick Event. This supports the advice to disable further clicks until the process is completed.
|
By Edhy Rijo - 11/19/2010
Thanks Greg, very good information about those events.
|