Dropdown
Basic dropdown with event log
A dropdown of fruit names logs the picked option on change.
A single dropdown anchored to LV_ALIGN_TOP_MID is filled with a newline
separated list of ten fruits via lv_dropdown_set_options. An LV_EVENT_ALL
handler reacts to LV_EVENT_VALUE_CHANGED by copying the current selection
with lv_dropdown_get_selected_str and printing it through LV_LOG_USER.
Dropdowns opening in four directions
Four dropdowns share a menu and open toward top, bottom, left, and right.
Four dropdowns built from the same Apple/Banana/Orange/Melon option string
are anchored to the top, bottom, left, and right of the screen. Each one
sets its open direction through lv_dropdown_set_dir (LV_DIR_BOTTOM,
LV_DIR_RIGHT, LV_DIR_LEFT) and picks a matching arrow via
lv_dropdown_set_symbol (LV_SYMBOL_UP, LV_SYMBOL_RIGHT,
LV_SYMBOL_LEFT). The top dropdown keeps the default downward open.
Dropdown styled as a menu
Turn a dropdown into a fixed-label menu with a rotating caret image.
A dropdown in the top-left is filled with file-menu actions and given a
fixed button label of Menu via lv_dropdown_set_text. img_caret_down is
installed with lv_dropdown_set_symbol and rotated 180 degrees on
LV_PART_INDICATOR | LV_STATE_CHECKED using transform_rotation so the
caret flips when the list opens. lv_dropdown_set_selected_highlight(false)
drops the last-picked highlight, and an LV_EVENT_VALUE_CHANGED handler
logs the chosen item.
How is this guide?
Last updated on