Layout#

Layout

Arranges the elements of a panel automatically, so that they do not have to be positioned one by one. See POST /ui/panel/(id)/add-horizontal-layout, POST /ui/panel/(id)/add-vertical-layout and POST /ui/panel/(id)/add-grid-layout.

A Layout object is passed and returned as its identifier, a number. A path that acts on an object takes it as (id).

GET /ui/layout/(id)/spacing#

The gap left between the elements, in pixels. A grid layout uses it in both directions.

Parameters:
  • id – The identifier of the Layout object.

Response JSON Object:
  • value (float)

PUT /ui/layout/(id)/spacing#

The gap left between the elements, in pixels. A grid layout uses it in both directions.

Parameters:
  • id – The identifier of the Layout object.

Request JSON Object:
  • value (float) – The new value.

GET /ui/layout/(id)/padding#

The gap left inside the edges of the panel.

Parameters:
  • id – The identifier of the Layout object.

Response JSON Object:
  • value (UI.Padding)

PUT /ui/layout/(id)/padding#

The gap left inside the edges of the panel.

Parameters:
  • id – The identifier of the Layout object.

Request JSON Object:
  • value (UI.Padding) – The new value.

GET /ui/layout/(id)/child-alignment#

Where the elements are placed within the space the layout has to fill.

Parameters:
  • id – The identifier of the Layout object.

Response JSON Object:
  • value (UI.TextAnchor)

PUT /ui/layout/(id)/child-alignment#

Where the elements are placed within the space the layout has to fill.

Parameters:
  • id – The identifier of the Layout object.

Request JSON Object:
  • value (UI.TextAnchor) – The new value.

GET /ui/layout/(id)/cell-size#

The size of each cell of a grid layout, in pixels.

Note

Only applies to a grid layout. Throws an exception for the other layouts, whose elements are sized individually using their layout elements.

Parameters:
  • id – The identifier of the Layout object.

Response JSON Object:
  • value (tuple<double, double>)

PUT /ui/layout/(id)/cell-size#

The size of each cell of a grid layout, in pixels.

Note

Only applies to a grid layout. Throws an exception for the other layouts, whose elements are sized individually using their layout elements.

Parameters:
  • id – The identifier of the Layout object.

Request JSON Object:
  • value (tuple<double, double>) – The new value.

GET /ui/layout/(id)/constraint#

What fixes the shape of a grid layout.

Note

Only applies to a grid layout. Throws an exception for the other layouts.

Parameters:
  • id – The identifier of the Layout object.

Response JSON Object:
  • value (UI.GridConstraint)

PUT /ui/layout/(id)/constraint#

What fixes the shape of a grid layout.

Note

Only applies to a grid layout. Throws an exception for the other layouts.

Parameters:
  • id – The identifier of the Layout object.

Request JSON Object:
  • value (UI.GridConstraint) – The new value.

GET /ui/layout/(id)/constraint-count#

The number of columns or rows that GET /ui/layout/(id)/constraint fixes, ignored when the constraint is "flexible".

Note

Only applies to a grid layout. Throws an exception for the other layouts.

Parameters:
  • id – The identifier of the Layout object.

Response JSON Object:
  • value (int32)

PUT /ui/layout/(id)/constraint-count#

The number of columns or rows that GET /ui/layout/(id)/constraint fixes, ignored when the constraint is "flexible".

Note

Only applies to a grid layout. Throws an exception for the other layouts.

Parameters:
  • id – The identifier of the Layout object.

Request JSON Object:
  • value (int32) – The new value.

Padding

The gap left inside each edge of a layout, in whole pixels.

Passed and returned as an object with these fields:

left (int32)

The gap inside the left edge.

right (int32)

The gap inside the right edge.

top (int32)

The gap inside the top edge.

bottom (int32)

The gap inside the bottom edge.

GridConstraint

What fixes the shape of a grid layout.

Passed and returned as the name of one of its values:

"flexible"

Fit as many columns and rows as the size of the panel allows.

"fixed_column_count"

Use a fixed number of columns, and as many rows as are needed.

"fixed_row_count"

Use a fixed number of rows, and as many columns as are needed.