Align two windows

Hello,
How do I align a window to the right side of my app’s main window?
Thanks.

Which platform? Which version of Xojo? What have you tried? How does your code look like? What are you struggling with?

As far as I remember there are functions for grouping windows in the MBS plugin.

Xojo last release (2022) on Mac platform
I tried with rect and Bounds commands
I don’t have MBS.

It’s just displaying a window that is placed just to the right of the main window of my app.
Thanks

You have the top, left and width of tha main window, so you set the top and left of the other window to match. Of course, this assumes you are not going to be moving the main window after having aligned them.

self.left = Mainwindow.left + MainWindow.width-self.width

You can put this into the Moved event of the principal window :

Sub Moved() Handles Moved
Window2.Top = Window1.Top
Window2.Left = Window1.Left+Window1.Width+10
End Sub

Assuming the window is resizable, you’ll need it in the resized and resizing events also.

1 Like