Window.left for multiple screens

Windows 10 64bit Xojo 2022.r2

Coming from an event in WebView2, I set the window.left position to event.screenX.

Unfortunately, Xojo window is sticked on second screen when moved once there…

Is there a Monkeybread solution or winAPI solution to move the window over multiple screens?

Problem seems to be because I use three screens where the middle one is the main screen.
So, moving to left screen, no problem, moving to right screen, window sticks there…

Maybe easier than I guess…

Thanks in advance

Btw. I do this because we have no custom titlebar available in Xojo
(Custom Title Bar for VCL Forms - RAD Studio)

What do you mean by “sticked”? The user can’t move the window back to other screens?

Normally, you can move a window to another screen by computing the other’s screen coordinates.
Say you have 3 screens, aligned horizontally. The main screen is the one at the center and is 1920x1080. The left one is 1600x900 and the right one is 1280x720.
With that setup, you can set the left property of a given window to move it to a given screen as follows:
Window.Left=0 'Move to the main screen (always {0;0}).
Window.Left=1920 'Move to the left border of the right screen (after the width of the main screen starts the right screen)
Window.Left=-1600 'Move to the left border of the left screen (0-width of the left screen, since 0 means the main screen).
(of course, with a valid top).
Not sure what your problem is beyond that…

1 Like

@Arnaud_N yes; as I send the new position, window stays “sticked” on the desktop once entered there. New position is then valid for that desktop.
@Rick_Araujo thanks a lot for the tipp; I can put the position in groups and translate to screen/desktop for Xojo; should work.

For now, I will not take care and use this as is.

Thanks a lot!

1 Like