UICheckbox

Classes

UICheckbox : UIComponent

Note

UIFrame component is automatically added to the node if it is not already present

Checkbox UI component that toggles a boolean value when clicked.

Usage example:

def init_checkbox() {
    get_component(node) $(var checkbox : UICheckbox?) {
        checkbox.onChange = @(newValue : bool) { print("Checkbox {checkbox.nodeId} toggled to {checkbox.value}!") }
    }
}
Fields:
  • toggleNode : NodeId - Node that visually represents the toggled state.

  • toggleFadeDuration : float = 0.1f - Duration of fade animation when toggling.

  • onChange : lambda<(value:bool):void> - Callback invoked when the value changes.

UICheckbox.on_initialize()

Initializes the checkbox component, sets up event listeners and initial state.

UICheckbox.setValue(newValue: bool; doFade: bool)

Sets the value and updates the toggle node.

Arguments:
  • newValue : bool - The new value.

  • doFade : bool - Whether to animate the toggle.

UICheckbox.invalidate(doFade: bool)

Updates the visual state of the checkbox.

Arguments:
  • doFade : bool - Whether to animate the toggle.

Properties:

UICheckbox.value: bool

Gets the current value of the checkbox.

UICheckbox.value =(newValue: bool)

Sets the value of the checkbox and updates the toggle node.

Arguments:
  • newValue : bool