Table
Styled table with header and zebra rows
Two-column fruits-and-prices table with custom header, right-aligned first column, and alternating rows.
A lv_table is filled with fruit names in column 0 and dollar prices
in column 1. The table height is capped at 200 px so the body
scrolls. With LV_OBJ_FLAG_SEND_DRAW_TASK_EVENTS set, an
LV_EVENT_DRAW_TASK_ADDED callback tints the header row blue and
center-aligns its text, right-aligns the first column's labels, and
adds a grey wash on every other body row by editing the
lv_draw_fill_dsc_t and lv_draw_label_dsc_t of each
LV_PART_ITEMS task.
200-row list with custom switch cell
Scrollable 200-item table that draws a toggle switch per row and reports build cost.
lv_mem_monitor and lv_tick_get bracket the creation of a one-column,
200-row table to measure memory and time usage. Each row is filled
with lv_table_set_cell_value_fmt. An LV_EVENT_DRAW_TASK_ADDED
handler intercepts each LV_PART_ITEMS fill task and paints a pill
track and knob whose position and color reflect the row's
LV_TABLE_CELL_CTRL_CUSTOM_1 flag. An LV_EVENT_VALUE_CHANGED
handler toggles that flag on the selected row. A bottom label reports
the row count along with elapsed time and bytes used.
How is this guide?
Last updated on