Skip to main content
Version: v2.4.0 (Current)

🔘 Button

The Button widget is the most fundamental interactive element in any HMI. It is designed to trigger actions, navigate between screens, or toggle system states when clicked or pressed.


⚙️ Properties (Props)

The Button configuration is derived from the ButtonWidget interface. While simple in structure, it relies heavily on the Styles and Events panels for its behavior.

PropertyTypeDescription
TextstringThe label displayed inside the button.
CheckablebooleanIf enabled, the button acts as a toggle (sticky) rather than a momentary switch.
X / YnumberThe coordinate position on the canvas.
Width / HeightnumberThe physical dimensions of the touch area.

🎨 Visual States

A Button's appearance changes based on user interaction. You can customize these transitions in the Style Panel:

  • Released (Default): The standard appearance when no interaction is occurring.
  • Pressed: The visual feedback provided while the user is actively touching the button (e.g., a darker color or a slight scale down).
  • Checked: The state displayed when a checkable button is "ON".
  • Disabled: The appearance when the button is inactive and non-interactive.

⚡ Runtime API (Lua)

Buttons are typically the primary triggers for Logic and Events. Use Lua to change labels or states dynamically.

-- Change the button text based on a condition
if machine_running then
btn_start:set_text("STOP")
btn_start:set_style_bg_color(0xFF0000) -- Change to red
else
btn_start:set_text("START")
btn_start:set_style_bg_color(0x00FF00) -- Change to green
end

-- Manually trigger a toggle state
btn_toggle:set_checked(true)

AI INTERACTIONS

Not sure how to script a screen transition? Use AI Interactions and simply type: "When this button is clicked, go to the Settings screen and play a click sound."


🚀 Next Steps

  • Image Button — Use this if you want to use custom image assets instead of rendered shapes.
  • Button Matrix — Use this for groups of multiple buttons (like a numpad) to save memory.
  • Logic and Events — Learn how to bind Lua functions to the CLICKED event.