Jump to content

Application.Display.OnMouseMove


Recommended Posts

I think I have to use   Application.Display.SetCapture to capture global mouse movements but after I do that, I can't capture any w3Panel's OnmouseDown event? It used to work fine.

 

Did I miss something?

 

Application.Display.SetCapture;

 Application.Display.OnMouseMove := DisplayMouseMove;

Link to post
Share on other sites
  • Administrators

All the mouse and touch events are these days handled centrally by TW3EventManger. When the mouse moves anywhere in the document, it finds out which component it should belong to and generates the mousemove. If you use SetCapture, the Event Manager makes sure to only send the mousemove event to that component and nowhere else.

The old versions of Smart Mobile Studio was not as strict, but that resulted in all kinds of other problems where the same event could fire multiple times etc.

If you want to be able to listen to global mouse movements, you can still do it with addEventListener:

uses
  ...
  W3C.DOM,
  ...

procedure GlobalMouseMove(eventObj: JMouseEvent);
begin
  WriteLn('Global Mousemove!');
end;

Application.Document.Handle.addEventListener('mousemove', @GlobalMouseMove, True);

 

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...