Button (lv_button)
A clickable Base Widget with defaults tuned for buttons (not scrollable, added to the default group, sized to fit its child).
Overview
A Button is a clickable base widget with three
defaults tuned for its role: not scrollable, added to the default group,
and LV_SIZE_CONTENT for both axes so it hugs its label child.
States
The two button-relevant states are LV_STATE_CHECKED (toggled by a
click when the LV_OBJ_FLAG_CHECKABLE flag is set) and LV_STATE_DISABLED
(greys out the button and ignores input).
Styling
A button has only LV_PART_MAIN but picks up the full base-widget style
stack: bg_color, radius, border_*, outline_*, shadow_*,
pad_*, text_color.
State-aware styling is the headline feature: attach separate styles with
selector="pressed", "checked", "focused", or "disabled" so the
button changes look as the user interacts with it.
Events
LV_EVENT_VALUE_CHANGEDwhen theLV_OBJ_FLAG_CHECKABLEflag is enabled and the Widget is clicked. The event happens on transition to/from the checked state.
Learn more about Events emitted by all Widgets.
Keys
Note that the state of LV_KEY_ENTER is translated to
LV_EVENT_PRESSED, LV_EVENT_PRESSING
and LV_EVENT_RELEASED etc.
Learn more about Keys.
Last updated on
Bar (lv_bar)
Non-interactive progress bar with a background and an indicator whose length shows the current value.
Button Matrix (lv_buttonmatrix)
A lightweight way to display many buttons in rows and columns. The buttons are drawn on the fly instead of being created as separate widgets, so memory use stays low.