UIButton

Classes

UIButton : UIComponent

Note

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

A button component that can be clicked. It can be used to trigger functions when clicked.

Usage example:

def init_button() {
    get_component(node) $(var btn : UIButton?) {
        btn.onClick = @() { print("Button {btn.nodeId} clicked!") }
    }
}

Note

To work properly, UICanvas component is required in one of the parent nodes.

Fields:
  • onClick : lambda<void> - The lambda to be called when the button is clicked.

UIButton.on_initialize()

Initializes the button component. Adds a mouse event listener.

UIButton.on_destroy()

Destroys the button component. Removes the mouse event listener.