Align 2 Windows (Example Code)

Just thought I’d share this tiny code snippet that will align two windows in case it’s useful to someone. Just pop it in a module and use like this. Works on Mac/PC. Probably doesn’t align on Unix quite correctly.

Window.AlignTo(OtherWindow)

[code]
Sub AlignTo(extends windowToMove as Window, dockToThisWindow as Window)
// Moves window to align to right edge of dockToThisWindow
// dockToThisWindow doesn’t move

dim windowFrameWidth as integer = windowToMove.left - windowToMove.bounds.left
dim newWindowLeft as integer = dockToThisWindow.bounds.Right + windowFrameWidth
windowToMove.left = newWindowLeft
windowToMove.top = dockToThisWindow.top
End Sub[/code]

Thanks for this. While I don’t need the functionality it has indirectly solved a stupid bug I had in the save/restore window size and position routines :slight_smile:

Glad to have helped