Skip to main content

setStyleProperty

info

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

Sets a property value on a style applied to the widget — the Styles parts such as background, border, margin, and size. Name the target part by its style name, then give the property name and the value for that part. Unlike setProperty, which targets the widget itself, this targets the style parts layered onto the widget.

  • Parameters
    • styleName (string): The name of the target style part — the part name shown in the widget's Styles list
    • styleProperty (string): The property name on that part
    • value (any): The value to set
  • Returns: The widget itself, so you can chain further calls. Most of the time you ignore the return value and use the call purely to set something.

Pass "enabled" as styleProperty with a boolean value to turn that style part itself on or off.

Example

boxID.setStyleProperty("DecoratedBox", "color", "#FF0000");
boxID.setStyleProperty("DecoratedBox", "enabled", false);
warning

A style name or property name that doesn't exist is ignored without an error — the value simply isn't applied. Use the name of a style part that is actually applied to the widget.