The window 'moved' event is triggering while moving window


The window ‘moved’ event does trigger WHILE moving a window. Especially if you move the window slow.

As a test I counted the amount of triggers by moving a window from left to right, at a slow pace with a continual-not stopping-motion.
The event was triggered +200 times although it should only be triggered ones when I stopped dragging the window (remember, the event is called ‘moved’).

I included a simple example in the feedback case. Compile it and slowly, but do not stop, dragging the window. The ‘beep’ command will be heard while dragging.

At the moment you begin to move, left or top are changed.


The window has been moved by the user or by code that changes the window’s Left or Top properties.[/quote]

Check if the mouse is down, during the move, and you can either ignore those Moved events, or you can sub-class the window and create a Moving event…

Shouldn’t the event then be called ‘Moving’. ‘Moved’ means the move has been finished imo and should be only triggered when the user lets mouse go.

This is impossible otherwise. If there were a Window’s Right or Bottom properties, they would also been modified too.
:frowning: or :wink: I cannot decide which one to use.

Keep in mind that the mouse will not be down if the window is being moved via keyboard. And depending on Xojo’s mechanism of mouse detection, it may also not be down if the window is being moved via touchscreen. There’s a third case as well, if the window is moved by a third-party window manager or via the Windows arrangement functions such as tile/cascade.

This is a difficult one for Xojo to take on, because some applications will want to take action during the move while some will want to take action at its conclusion (as you do). Perhaps you could use a timer, where your actions inside the event will be limited to once every so often.