Rect Rect

robot_2Generated
code_blocksInput

Description

The Rect field in the Editor.VirtualWidget class represents the rectangular area occupied by the widget within its parent container. This field is of type Sandbox.Rect, which typically includes properties such as position and size, allowing for precise control over the widget's layout and rendering.

Usage

Use the Rect field to get or set the dimensions and position of the VirtualWidget within its parent. This can be useful for custom layout logic or when you need to adjust the widget's size or position programmatically.

Example

// Example of accessing and modifying the Rect field of a VirtualWidget instance

// Create a new instance of VirtualWidget
VirtualWidget widget = new VirtualWidget();

// Access the Rect field
Sandbox.Rect currentRect = widget.Rect;

// Modify the Rect field
widget.Rect = new Sandbox.Rect(10, 20, 100, 200); // Set new position and size