.. _stdlib_ui_button_component: ======== UIButton ======== +++++++ Classes +++++++ .. _struct-ui_button_component-UIButton: .. das:attribute:: 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 - The lambda to be called when the button is clicked. .. _function-ui_button_component_UIButton_rq_on_initialize_UIButton: .. das:function:: UIButton.on_initialize() Initializes the button component. Adds a mouse event listener. .. _function-ui_button_component_UIButton_rq_on_destroy_UIButton: .. das:function:: UIButton.on_destroy() Destroys the button component. Removes the mouse event listener.