Jump to content
Sign in to follow this  


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.OnMouseMove := DisplayMouseMove;

Share this post

Link to post
Share on other sites

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:


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

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


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this