Skip to main content

Checkbox (체크박스) Widget Control

info

Example file: 07_Work_with_Widgets/checkbox_objet.lfp

The Widget Controls (Property · Method · Event) you use to control the Checkbox widget from a script. For an introduction to the widget and how to use it, see Checkbox.

info

In the examples below, checkboxID is the name (ID) you assigned to the Checkbox widget on the canvas. In a script, access it as widgetID.member.

Widget Control summary

Widget ControlKindSignatureDescription
checkPropertyboolean (Read/write)Current checked state
onChangedEventonChanged = (value) => { ... }Runs when the checked state changes

Property

check

The current checked state. true means checked. Both reading and writing are supported.

  • Type: boolean
  • Access: Read / write

Example

// Change it to the checked state
checkboxID.check = true;

// Read the current state
const isChecked = checkboxID.check;

Method

info

Not applicable — the Checkbox widget has no dedicated Method. Use the common Widget Control below.

Event

onChanged

Runs when the checked state changes.

  • Kind: Event
  • Handler arguments
    • value (boolean): The checked state after the change (true means checked)
  • Returns: None

Example

checkboxID.onChanged = (value) => {
// value: the new checked state
};

Common Widget Control (all widgets)

note

Every widget can also use common Widget Controls (Method) such as setProperty(name, value) / getProperty(name) / setStyleProperty(styleName, styleProperty, value). For the full rules, see the common Widget Control reference.