Skip to main content

setProperty

Sets a property value on the widget itself by name and applies it on screen. The name is the name of a property that widget defines, so it varies from widget to widget — for example, text or textAlign on the Text widget.

info

This is a Widget Control shared by every widget. In the example below, widgetID is the name (ID) you assigned to the widget on the canvas, and in scripts you access members as widgetID.member.

  • Parameters
    • name (string): The name of the widget property to set
    • value (any): The value to set. Specify color and enum-style properties as strings.
  • Returns: Returns the widget itself, so you can chain more calls. Normally you ignore the return value and use the method just to set a value.

Example

textID.setProperty("text", "Hello");
warning

If you pass a property name that doesn't exist, nothing happens and no error is raised — the value simply isn't applied. Available property names differ by widget, so check the property names for that widget before you use it.