Skip to main content

setLayoutProperty

Sets a widget's layout-related properties. There are two kinds of target: (1) the widget's own layout meta properties, and (2) its placement properties inside the parent container.

info

A Widget Control that every widget shares. In the examples below, widgetID is the name (ID) assigned to the widget on the canvas, and in scripts you access members as widgetID.member.

  • Parameters
    • name (string): The name of the layout property to set
    • value (any): The value to set
  • Returns: The widget itself, so you can chain further calls. Usually you ignore the return value and call it purely to set a property.

Names you can use:

  • Always available (widget meta): visible, tag, responsive, id, description, analytics
  • When the parent is a Row or Column: flex, fit
  • When the parent is a Stack: top, left, right, bottom, width, height

Example

imgID.setLayoutProperty("visible", false);
imgID.setLayoutProperty("flex", 2);
imgID.setLayoutProperty("top", 20);
warning

Placement properties such as flex, top, and width depend on the kind of parent container the widget sits in. top applies only to a child of a Stack, and flex only to a child of a Row or Column — when the condition isn't met, the call is ignored without an error. Margin, padding, and disable are not targets of this control: use style parts for margin and padding, and the disable property to disable a widget.