Disabling MouseUp in a WebImageView

Hi, I am using WebImageViews for buttons in my web app. Code that gets actioned is put in the MouseUp event, as if it is in MouseDown and the user holds their mouse button down (or finger on an iPad) then the code gets executed multiple times. My problem is if the user double-clicks the control, the MouseUp fires twice and the code gets run twice.

I have tried to prevent the second MouseUp from running the action with code as below, but there is a timing issue and the webPage1.ButtonPressed boolean does not get set in time before the second MouseUp event fires. The app is running on a Centos server.

if not webPage1.ButtonPressed then
webPage1.ButtonPressed = True

// action code here

// allow buttons to be clicked again
webPage1.ButtonPressed = False

end if

If anyone has any ideas how I can prevent the second MouseUp, or otherwise how I can resolve this, I’d be grateful to hear them!
Thanks, Eric

Have you checked if DoubleClick is fired ? If so you can set a public flag in there that would prevent a second execution in MouseUp.

In DoubleClick :
ClickOnce = True

in MouseUp :
If ClickOnce = False then
//do your thing
end if

You could set ClickOnce as False in MouseDown

Alternatively, you may want to move your code from MouseUp to MouseDown…

PS : Please discard your second post in Customer Service

Hi Michel, thanks for posting. It seems that DoubleClick does not fire. Sometimes, only one MouseUp fires and sometimes two. I can’t use MouseDown as if there user holds the mouse button down, the code fires multiple times.

Without changing too much of your code, you can use the same flag system to execute your code only once.

Set ClickOnce as public property and default value False

in MouseUp :
If ClickOnce = False then
//do your thing
ClickOnce = True
end if

As it stands, the code will be executed once per session.

The tricky part is then to figure where to reset ClickOnce to False, so the customer can click again if needed. I do not know your app, so it is difficult to tell you where, but in essence, wherever the user is suppose to click afterwards, or when you change page, or whatever it is safe. You can also use a timer to reset ClickOnce after a set amount of time.

Hi Michel, I see where you are coming from. This is interesting, thanks. I will have a look.

I have the same issue with WebSegmentedControl on action event (double execution). This is a framework issue on client side, because it request twice on server for the same event.