MouseDown / MouseUp /Click

I have a button that is displayed as an image on the webpage.
With Mousedown over the image start a timer incrementing of a value and with MouseUp stop it.
As long as I do not move the Mouse it works, as soon as you move the mouse, I no longer receive a MouseUp event.

The other question is how I can switch off the drag and drop of an image on the webpage so that this hover effect does not occur.


I could not reproduce the issue with OnMouseUp.

To avoid this drag, set a style attribute'pointer-events','none');

I made two small projects where it becomes visible that the dragmode in VCL differently to the dragmode in WebCore. First make a mouse down to the graphic, then move the mouse, then mouse up.

the green button in VCL Result (mousedown, mouseup, Click)
the red button in VCL Result (mousedown, Startdrag ... EndDrag)

There is no difference in the WebCore version.

I made an addition to the TMS_Test project:

procedure TForm10.WebFormCreate(Sender: TObject);

now nothing happens with the green image (no mouse down etc.) (35.7 KB)

Disable start browser dragging of the image with code like:

procedure TForm10.WebFormCreate(Sender: TObject);
  el: TJSElement;
  el := WebImageControl1.ElementHandle;
  el.ondragstart = function() { return false; };

Thank you so works.
But I still have to implement the StartDrag to stop the incrementing.

But now there is a new problem.

If I run the Page on a PC (Firefox etc.) my example works correctly.
When I run it on a smartphone browser, become two MouseDown / Up triggered
or when I hold the button for a long time, the popup opens. (mouse right)
Is there a solution for that too?
So only once mouse down and up and no mouse right (popup)

Test (12.8 KB)

I found switching off the popup menu.

el.oncontextmenu = function() { return false; };

the double mouse trigger (down..up..down..up) still comes

on Chrome and Opera Browser the solution works (ContextMenu)
on Safari and firefox the solution does not work --> the ContextMenu is displayd

Did you try to do the same for the el.touchstart event?

have now redirected the following functions

      el.oncontextmenu = function() { return false; };
      el.ondragstart   = function() { return false; };
      el.ontouchstart  = function() { return false; };
      el.ontouchmove   = function() { return false; };
      el.ontouchend    = function() { return false; };
      el.ontouchcancel = function() { return false; };

now it's going as I would like
thank's for the Tipps