Canvas Toolkit
← Class index

CGridLayout

Layouts · extends CLayout

Layout that arranges widgets in a row-and-column grid. Widgets may span multiple cells, and rows and columns may be assigned independent stretch factors.

import { CGridLayout } from "canvas-toolkit-lib";

Declared members

addWidget(widget: CWidget): void;

Adds a widget to the grid. Without coordinates, the widget is placed automatically. Explicit coordinates may also specify row and column spans.

addWidget(widget: CWidget, row: number, column: number, rowSpan?: number, columnSpan?: number, alignment?: CAlignment | 0): void;
addSpacerItem(spacer: CSpacerItem, row: number, column: number, rowSpan?: number, columnSpan?: number): void;

Adds a spacer at a grid position, optionally spanning several cells.

clear(): void;
rowCount(): number;

Returns the number of rows currently occupied by grid items.

columnCount(): number;

Returns the number of columns currently occupied by grid items.

setRowStretch(row: number, stretch: number): void;

Sets the non-negative stretch factor for a row.

setColumnStretch(column: number, stretch: number): void;

Sets the non-negative stretch factor for a column.

rowStretch(row: number): number;

Returns the stretch factor for a row.

columnStretch(column: number): number;

Returns the stretch factor for a column.

sizeHint(): CSize;

Returns the preferred size required by the grid.

heightForWidth(width: number): number;
update(): void;

Recalculates and applies grid-cell geometries.