Button Matrix (lv_buttonmatrix)

Many buttons in rows and columns drawn virtually from a single text map.

Overview

The Button Matrix displays many buttons arranged in rows and columns from a single text map. The buttons are drawn virtually rather than created as individual widgets, making it a very memory-efficient way to show a grid of buttons.

Learn more in the LVGL Open documentation.

Enumerations

lv_buttonmatrix_ctrl — Control flags you can apply to individual buttons (values can be combined)

ValueDescription
noneMake the button use the default state with no special control
width_1Make the button take 1 unit of relative width in its row
width_2Make the button take 2 units of relative width in its row
width_3Make the button take 3 units of relative width in its row
width_4Make the button take 4 units of relative width in its row
width_5Make the button take 5 units of relative width in its row
width_6Make the button take 6 units of relative width in its row
width_7Make the button take 7 units of relative width in its row
width_8Make the button take 8 units of relative width in its row
width_9Make the button take 9 units of relative width in its row
width_10Make the button take 10 units of relative width in its row
width_11Make the button take 11 units of relative width in its row
width_12Make the button take 12 units of relative width in its row
width_13Make the button take 13 units of relative width in its row
width_14Make the button take 14 units of relative width in its row
width_15Make the button take 15 units of relative width in its row
hiddenMake the button hidden
no_repeatDisable long-press repeat on the button
disabledMake the button disabled (not clickable)
checkableMake the button toggleable when clicked
checkedKeep the button in the toggled (checked) state
click_trigTrigger LV_EVENT_VALUE_CHANGED on CLICK instead of PRESS
popoverShow a popover when pressing the button
recolorEnable text recoloring with inline #color codes
reserved_1Reserved flag for future use
reserved_2Reserved flag for future use
custom_1Custom flag free to use by the user
custom_2Custom flag free to use by the user

Properties

Parts

Style parts of the widget with local style (e.g. style_bg_color-knob="0xff0000") or with style sheets (e.g. <style name="style_knob" selector="knob">). See Styles to learn more.

PartDescription
mainThe background behind the buttons: background properties. pad_row and pad_column set the gaps between buttons.
itemsThe buttons: text and background properties (transforms are not applied). Combine with the 'checked', 'pressed', 'focused' and 'disabled' states, e.g. items|checked.

Properties below are the widget's XML <api>; see API for how properties, parameters and elements work.

PropertyTypeDescription
mapstring[NULL]Set the layout map of the button matrix using text strings and \n for line breaks (e.g. 'a' 'b' 'c')
ctrl_mapenum:lv_buttonmatrix_ctrl[]+Set the control flags for each button in the map
one_checkedboolForce exactly one button to stay checked at all times
selected_buttonintSelect a button by index (new lines do not count)

Last updated on

On this page