Hello,
We’ve encountered an issue with double-clicks. When a user starts rapidly clicking on a component (buttons, link labels, or others), another double-click gets queued before WiseJ displays the loading indicator and begins executing the code, causing our logic to be called multiple times. Is there a way to prevent this using WiseJ?
Expected behavior:
I double-click a button; the code for the double-click event is executed (no further double-clicks are registered at this point). Once the double-click logic has finished running, it becomes possible to trigger the double-click event again.
I’ve attached a sample where this can be observed.
Thank you for your answer.
Have you tried di define the dobleclick sub as Async and use a semaphore?
Hi Pavel,
maybe I missed the point of your sample but if I change the code like this I don’t get any further double clicks during the processing of the double click event:
private void Button1_DoubleClick(object sender, System.EventArgs e)
{
this.button1.Enabled = false;
Application.Update(this);
this.label1.Text += $"\r\nDouble click at {DateTime.Now:HH:mm:ss.fff}";
Thread.Sleep(2000);
this.button1.Enabled = true;
}
If this is not the intended behavior, please explain in more detail or update your sample to demonstrate it.
Thanks in advance.
Best regards
Frank
Unfortunately, setting `dropDuplicateClicks` didn’t help, and disabling the button or creating a flag won’t help either, because the events aren’t triggered in parallel but in sequence. Is there any other way to handle this, please?
Hi Pavel,
you might want to try adding
dropDuplicateClicks = true
to your default json. If that is not enough you could disable the button while your handler is running and reenable it at the end or add a busy flag that you can check.
Best regards
Frank
Attaching sample code…
Please login first to submit.
