DesktopWindow.Bounds

From Xojo Documentation

You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!

Property (As Rect )
aDesktopWindow.Bounds = newRectValue
or
RectValue = aDesktopWindow.Bounds

New in 2021r3

Supported for all project types and targets.

Use this property to Get/Set the true bounds of a window (i.e. including frame/title decorations).

Notes

On Linux the Left/Top bounds exclude the decorations due to the way window decorations are handled there.

Examples

To get the bounds:

Var winBounds As Rect
winBounds = Self.Bounds
MessageBox("Left = " + winBounds.Left.ToString)

To set the bounds, do not modify the Bounds properly directly. This does not work because you will be modifying a temporary object. Instead set the bounds in your own Realbasic.Rect instance and assign that to bounds:

Var myBounds As New Rect
myBounds.Left = 100
myBounds.Top = 100
myBounds.Height = Self.Height
myBounds.Width = Self.Width
Self.Bounds = myBounds