Web interface mouse down triggered multiple times on Image Wells

Hi everyone,

In Web Apps, we use Image Wells as buttons. We use the mousedown event as the “Action event”. We noticed that, if we double or triple click fast enough our "Image Well Button, the action is executed as many times as I click on the button… Every click is recorded…

Has anyone noticed that or found a way to avoid such a behavior? I though of using a ‘triggered’ property to eliminate repeated actions.

Any suggestion?


Don’t use MouseDown anyway. Use MouseUp instead, and verify that the mouse is inside the control before doing the action. That is the way normal buttons work. So if the user has a remorse and does not actually want to validate the push, he slides off the button and when he releases the mouse the action does not take place.

It will most probably solve your issue.

Nice! Thanks Michel! I’ll try that! By the way, are you French? I am a qubcois…

Merci beaucoup et au plaisir!

Well Roger, nobody is perfect… :wink:

Merci Louis! :slight_smile: Eh bien un dveloppeur Xojo Montral… Faudrait qu’on se parle!

Avec plaisir, Roger :slight_smile:

I finally solved this issue by following your advice and reading some older posts relative to identifying the cursor position…
I kept my button actions in Mouse Down since I did not figure out how to make Mouse Up active only while over the Webimageview.

Should I verify if the X And Y values are in a specific range? Something like : If X >= Me.Left And X <= Me.Left + Me.Width... There must be something more … elegant… :slight_smile:

So I focused on retarding a little while the responsiveness of my button.

Here what I did :

1- added a timer (as a proprety of a Class ) that is initialized in the “constructor” at the opening of the session

 //Paramtrage du timer de dsactivation temporaire des boutons
  buttonTimer = New Xojo.Core.Timer
  buttonTimer.Period = 1500
  buttonTimer.Mode = xojo.Core.Timer.Modes.Off
  AddHandler buttonTimer.Action, AddressOf buttonTimerAction

2- added a Boolean property to that same Class called "buttonWaiting"

3- added this handler method (buttonTimerAction) in that same Class

   buttonWaiting = False 

4- added this code to my button in MouseDown Event (Until I know how to use Mouse Up :wink: )

If Not buttonWaiting Then buttonWaiting = True buttonTimer.Mode = xojo.Core.Timer.Modes.Single // bla bla bla ..... End If

If there is any way I can improve this, let me know…

Thanks again!

There is another way I often use when something “stutters”. I do that for instance in a search field that works like the IDE’s. Each time keydown happens, it does not fire. But half a second after the last character has been punched, search happens.

buttonTimer = New Xojo.Core.Timer buttonTimer.Period = 500 buttonTimer.Mode = xojo.Core.Timer.Modes.Off

Note the much shorter period. I assume the button clicks at a rapid pace

In MouseDown

buttonTimer.Xojo.Core.Mode = Timer.Modes.Off buttonTimer.Xojo.Core.Mode = Timer.Modes.Single

Then put the code for the button Action in the Action event of the timer.

The way it works, each time mouseDown clicks, it restarts the time, so Action does not fire. When there is no more MOuseDown, then the timer fires and Action executes.

Nice! That’s exactly what I need! Merci normment!

Je vous en prie :slight_smile: