issue with double-clicks

0
0

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.

  • You must to post comments
0
0

Have you tried di define the dobleclick sub as Async and use a semaphore?

  • You must to post comments
0
0

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

  • You must to post comments
0
0

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?

  • You must to post comments
0
0

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

  • You must to post comments
0
0

Attaching sample code…

  • You must to post comments
Showing 5 results
Your Answer

Please first to submit.