LensStudio:Ui.GridLayout
ClassArranges child layouts and widgets in a grid with rows and columns.
Index
Properties
Methods
Example
const root = new Widget(parent);
const grid = new GridLayout();
grid.spacing = 6;
root.layout = grid;
// Row 0: header spanning 2 columns
const title = new Label(root);
title.text = 'Transform';
title.fontRole = FontRole.TitleBold;
grid.addWidgetWithSpan(title, 0, 0, 1, 2, Alignment.AlignLeft);
// Row 1-3: label + button pairs in a grid
const axes = ['X', 'Y', 'Z'];
const values = [0, 0, 0];
const labels: Label[] = [];
for (let i = 0; i < 3; i++) {
const axisLabel = new Label(root);
axisLabel.text = `${axes[i]}:`;
grid.addWidgetAt(axisLabel, i + 1, 0, Alignment.AlignRight);
const valLabel = new Label(root);
valLabel.text = `${values[i]}`;
valLabel.fontRole = FontRole.Monospace;
labels.push(valLabel);
grid.addWidgetAt(valLabel, i + 1, 1, Alignment.AlignLeft);
}
Extends
Constructors
Constructor
new GridLayout():
GridLayout
Constructor for a grid layout container that arranges child widgets in rows and columns.
Returns
GridLayout
Overrides
Layout.constructor
Properties
enabled
enabled:
boolean
Whether the layout is active and responsive to user input.
Inherited from
isNull
readonlyisNull:boolean
Whether this object references a valid layout.
Inherited from
spacing
spacing:
number
Distance between widgets in the layout.
Inherited from
Methods
addLayout()
addLayout(
layout,row,column,alignment):void
Add a layout to the grid at a specific row and column with alignment.
Parameters
Returns
void
addWidget()
addWidget(
widget):void
Add a widget to the layout.
Parameters
| Parameter | Type |
|---|---|
widget | Widget |
Returns
void
Inherited from
addWidgetAt()
addWidgetAt(
widget,row,column,alignment):void
Add a widget to the grid at a specific row and column with alignment.
Parameters
Returns
void
addWidgetWithSpan()
addWidgetWithSpan(
widget,fromRow,fromColumn,rowSpan,columnSpan,alignment):void
Add a widget to the grid spanning multiple rows and columns with alignment.
Parameters
| Parameter | Type |
|---|---|
widget | Widget |
fromRow | number |
fromColumn | number |
rowSpan | number |
columnSpan | number |
alignment | Alignment |
Returns
void
clear()
clear(
behavior):void
Remove all widgets from the layout with specified cleanup behavior.
Parameters
| Parameter | Type |
|---|---|
behavior | ClearLayoutBehavior |
Returns
void
Inherited from
deleteLater()
deleteLater():
void
Schedule layout for deletion after event processing.
Returns
void
Inherited from
getColumnMinimumWidth()
getColumnMinimumWidth(
column):number
Get the minimum width of a column.
Parameters
| Parameter | Type |
|---|---|
column | number |
Returns
number
getColumnStretch()
getColumnStretch(
column):number
Get the stretch factor of a column.
Parameters
| Parameter | Type |
|---|---|
column | number |
Returns
number
getRowMinimumHeight()
getRowMinimumHeight(
row):number
Get the minimum height of a row.
Parameters
| Parameter | Type |
|---|---|
row | number |
Returns
number
getRowStretch()
getRowStretch(
row):number
Get the stretch factor of a row.
Parameters
| Parameter | Type |
|---|---|
row | number |
Returns
number
getTypeName()
staticgetTypeName():string
Returns the type name of this class.
Returns
string
Overrides
getTypeName()
getTypeName():
string
Returns the name of this object's type.
Returns
string
Inherited from
isOfType()
isOfType(
type):boolean
Returns true if the object is of the specified type.
Parameters
| Parameter | Type |
|---|---|
type | string |
Returns
boolean
Inherited from
isSame()
isSame(
other):boolean
Returns true if this object refers to the same instance as the given object.
Parameters
| Parameter | Type |
|---|---|
other | ScriptObject |
Returns
boolean
Inherited from
setColumnMinimumWidth()
setColumnMinimumWidth(
column,minSize):void
Set the minimum width of a column.
Parameters
| Parameter | Type |
|---|---|
column | number |
minSize | number |
Returns
void
setColumnStretch()
setColumnStretch(
column,stretch):void
Set the stretch factor of a column.
Parameters
| Parameter | Type |
|---|---|
column | number |
stretch | number |
Returns
void
setContentsMargins()
setContentsMargins(
left,top,right,bottom):void
Set the margins around layout contents.
Parameters
| Parameter | Type |
|---|---|
left | number |
top | number |
right | number |
bottom | number |
Returns
void
Inherited from
setLayoutAlignment()
setLayoutAlignment(
layout,alignment):boolean
Set alignment for a nested layout within this layout.
Parameters
Returns
boolean
Inherited from
setRowMinimumHeight()
setRowMinimumHeight(
row,minSize):void
Set the minimum height of a row.
Parameters
| Parameter | Type |
|---|---|
row | number |
minSize | number |
Returns
void
setRowStretch()
setRowStretch(
row,stretch):void
Set the stretch factor of a row.
Parameters
| Parameter | Type |
|---|---|
row | number |
stretch | number |
Returns
void
setWidgetAlignment()
setWidgetAlignment(
widget,alignment):boolean
Set alignment for a widget within this layout.
Parameters
Returns
boolean