Get when a Window is moved by dragging the titleBar

Hi all,
Is there any way to know when a window has been moved by dragging the titleBar with the mouse-down? …If possible without the use of expensive plug-in.
I know I could use a Timer to monitor window moving, but I would prefer not have a timer running the all time with a period of 500 or less …
Thanks a lot!
Luciano

You know there is a Language Reference:

DesktopWindow-Moved

My bad …
I just assumed that ‘Moved’ was triggered at the end of the moving action, similarly to ‘Resizing’ and ‘Resized

I will test it.
Thanks !

That’s a keen observation, and might be worth a feature request if you feel it necessary.

Considering you asked for “moved” in your original post, you got what you asked for I think.

Moved
The window has been moved by the user or by code that changes the window’s Left or Top properties.

Fine, it was moved. But was it moved by the user or by code ? The answer is not here…

The code knows when it moved it…And when doing so the code can ignore event.moved()

For practical reasons I can’t imagine an use case I wish to differentiate.

It’s true that within his own code, he surely can know whether it was his code that did the moving. However, there are other ways windows get moved – the operating system can move them around when the screen resolution changes, for example, and hence it might be useful to know if the windows was moved by the user directly, or indirectly through some OS process. This has come up a few times over the years, so there must be some reason developers are interested in knowing.

If someone has one I wish to know.

I know use cases wishing to keep layouts in some proper places and sizes, the origin of the move no one cares. But observing events like resize and move are important. Also the resize of the “container” (virtual screen, array of displays/monitors).

fwiw, this can be done with plugins and is extremely difficult to do via declares.
Like, bending outside the framework, doing naughty things to runtime difficult.

Thanks to all for the feedback. I might stick to Timer to monitor window position over time, and then act based on that …
Thanks again !

Polling is generally a bad design, especially as there is a Moved event which you can use to know exactly when something changes.

1 Like