Skip to main content

setState

Turns a State style defined on a widget on or off. Turn a state on and the styles assigned to that state apply; turn it off and they are removed.

warning

If the widget has no State styles defined, setState has no effect. It works only on widgets that have State styles. Also, no common Widget Control tells you which state is currently on.

info

This Widget Control is common to every widget. In the examples below, widgetID is the name (ID) you assigned to the widget on the canvas, and in a script you access it as widgetID.member.

  • Parameters
    • stateName (string): the state name
    • active (boolean): true turns the state on, false turns it off
  • Returns: the widget itself, so you can chain further settings. In most cases you ignore the return value and call it just to apply the setting.

Example

cardID.setState("selected", true);