lv_table.h
API reference for lv_table.h
Functions
lv_table_set_cell_value
Set the value of a cell.
void lv_table_set_cell_value(lv_obj_t *obj, uint32_t row, uint32_t col, const char *txt)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a Table object |
row | uint32_t | id of the row [0 .. row_cnt -1] |
col | uint32_t | id of the column [0 .. col_cnt -1] |
txt | const char * | text to display in the cell. It will be copied and saved so this variable is not required after this function call. |
New roes/columns are added automatically if required
lv_table_set_cell_value_fmt
Set the value of a cell. Memory will be allocated to store the text by the table.
void lv_table_set_cell_value_fmt(lv_obj_t *obj, uint32_t row, uint32_t col, const char *fmt,...)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a Table object |
row | uint32_t | id of the row [0 .. row_cnt -1] |
col | uint32_t | id of the column [0 .. col_cnt -1] |
fmt | const char * | printf-like format |
... |
New roes/columns are added automatically if required
lv_table_set_row_count
Set the number of rows
void lv_table_set_row_count(lv_obj_t *obj, uint32_t row_cnt)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | table pointer to a Table object |
row_cnt | uint32_t | number of rows |
lv_table_set_column_count
Set the number of columns
void lv_table_set_column_count(lv_obj_t *obj, uint32_t col_cnt)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | table pointer to a Table object |
col_cnt | uint32_t | number of columns. |
lv_table_set_column_width
Set the width of a column
void lv_table_set_column_width(lv_obj_t *obj, uint32_t col_id, int32_t w)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | table pointer to a Table object |
col_id | uint32_t | id of the column [0 .. LV_TABLE_COL_MAX -1] |
w | int32_t | width of the column |
lv_table_set_cell_ctrl
Add control bits to the cell.
void lv_table_set_cell_ctrl(lv_obj_t *obj, uint32_t row, uint32_t col, lv_table_cell_ctrl_t ctrl)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a Table object |
row | uint32_t | id of the row [0 .. row_cnt -1] |
col | uint32_t | id of the column [0 .. col_cnt -1] |
ctrl | lv_table_cell_ctrl_t | OR-ed values from lv_table_cell_ctrl_t |
lv_table_set_cell_user_data
Add custom user data to the cell.
void lv_table_set_cell_user_data(lv_obj_t *obj, uint16_t row, uint16_t col, void *user_data)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a Table object |
row | uint16_t | id of the row [0 .. row_cnt -1] |
col | uint16_t | id of the column [0 .. col_cnt -1] |
user_data | void * | pointer to the new user_data. May be NULL. Should be allocated by lv_malloc, and it will be freed automatically when the table is deleted or when the cell is dropped due to lower row or column count. |
lv_table_set_selected_cell
Set the selected cell
void lv_table_set_selected_cell(lv_obj_t *obj, uint16_t row, uint16_t col)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a table object |
row | uint16_t | id of the cell row to select |
col | uint16_t | id of the cell column to select |
lv_table_get_cell_value
Get the value of a cell.
const char * lv_table_get_cell_value(lv_obj_t *obj, uint32_t row, uint32_t col)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a Table object |
row | uint32_t | id of the row [0 .. row_cnt -1] |
col | uint32_t | id of the column [0 .. col_cnt -1] |
Returns: const char * — text in the cell
lv_table_get_row_count
Get the number of rows.
uint32_t lv_table_get_row_count(lv_obj_t *obj)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | table pointer to a Table object |
Returns: uint32_t — number of rows.
lv_table_get_column_count
Get the number of columns.
uint32_t lv_table_get_column_count(lv_obj_t *obj)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | table pointer to a Table object |
Returns: uint32_t — number of columns.
lv_table_get_column_width
Get the width of a column
int32_t lv_table_get_column_width(lv_obj_t *obj, uint32_t col)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | table pointer to a Table object |
col | uint32_t | id of the column [0 .. LV_TABLE_COL_MAX -1] |
Returns: int32_t — width of the column
lv_table_get_selected_cell
Get the selected cell (pressed and or focused)
void lv_table_get_selected_cell(lv_obj_t *obj, uint32_t *row, uint32_t *col)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a table object |
row | uint32_t * | pointer to variable to store the selected row (LV_TABLE_CELL_NONE: if no cell selected) |
col | uint32_t * | pointer to variable to store the selected column (LV_TABLE_CELL_NONE: if no cell selected) |
lv_table_get_cell_user_data
Get custom user data to the cell.
void * lv_table_get_cell_user_data(lv_obj_t *obj, uint16_t row, uint16_t col)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a Table object |
row | uint16_t | id of the row [0 .. row_cnt -1] |
col | uint16_t | id of the column [0 .. col_cnt -1] |
lv_table_create
Create a table object
lv_obj_t * lv_table_create(lv_obj_t *parent)| Name | Type | Description |
|---|---|---|
parent | lv_obj_t * | pointer to a parent widget May be NULL.. When NULL, the widget is created as a screen on the default display. |
Returns: lv_obj_t * — pointer to the created table
lv_table_clear_cell_ctrl
Clear control bits of the cell.
void lv_table_clear_cell_ctrl(lv_obj_t *obj, uint32_t row, uint32_t col, lv_table_cell_ctrl_t ctrl)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a Table object |
row | uint32_t | id of the row [0 .. row_cnt -1] |
col | uint32_t | id of the column [0 .. col_cnt -1] |
ctrl | lv_table_cell_ctrl_t | OR-ed values from lv_table_cell_ctrl_t |
lv_table_has_cell_ctrl
Get whether a cell has the control bits
bool lv_table_has_cell_ctrl(lv_obj_t *obj, uint32_t row, uint32_t col, lv_table_cell_ctrl_t ctrl)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a Table object |
row | uint32_t | id of the row [0 .. row_cnt -1] |
col | uint32_t | id of the column [0 .. col_cnt -1] |
ctrl | lv_table_cell_ctrl_t | OR-ed values from lv_table_cell_ctrl_t |
Returns: bool — true: all control bits are set; false: not all control bits are set
Enums
lv_table_cell_ctrl_t
| Name | Value |
|---|---|
LV_TABLE_CELL_CTRL_NONE | 0 << 0 |
LV_TABLE_CELL_CTRL_MERGE_RIGHT | 1 << 0 |
LV_TABLE_CELL_CTRL_TEXT_CROP | 1 << 1 |
LV_TABLE_CELL_CTRL_CUSTOM_1 | 1 << 4 |
LV_TABLE_CELL_CTRL_CUSTOM_2 | 1 << 5 |
LV_TABLE_CELL_CTRL_CUSTOM_3 | 1 << 6 |
LV_TABLE_CELL_CTRL_CUSTOM_4 | 1 << 7 |
Used by 3 functions
lv_table_set_cell_ctrl— paramctrllv_table_clear_cell_ctrl— paramctrllv_table_has_cell_ctrl— paramctrl
_lv_property_table_id_t
| Name | Value |
|---|---|
LV_PROPERTY_TABLE_ROW_COUNT | (LV_PROPERTY_TABLE_START + ((int) 0 )) | (( 1 ) << 28 ) |
LV_PROPERTY_TABLE_COLUMN_COUNT | (LV_PROPERTY_TABLE_START + ((int) 1 )) | (( 1 ) << 28 ) |
LV_PROPERTY_TABLE_END |
Macros
LV_TABLE_CELL_NONE
#define LV_TABLE_CELL_NONE 0XFFFFVariables
lv_table_class
const lv_obj_class_t lv_table_classDependencies
Indirect dependencies
lv_anim.hlv_area.hlv_assert.hlv_bidi.hlv_color.hlv_color_op.hlv_conf_internal.hlv_display.hlv_draw.hlv_draw_arc.hlv_draw_blur.hlv_draw_buf.hlv_draw_image.hlv_draw_label.hlv_draw_line.hlv_draw_rect.hlv_draw_triangle.hlv_event.hlv_ext_data.hlv_flex.hlv_font.hlv_fs.hlv_grad.hlv_grid.hlv_group.hlv_image_decoder.hlv_image_dsc.hlv_indev.hlv_layout.hlv_ll.hlv_log.hlv_math.hlv_matrix.hlv_mem.hlv_obj.hlv_obj_class.hlv_obj_draw.hlv_obj_event.hlv_obj_pos.hlv_obj_scroll.hlv_obj_style.hlv_obj_style_gen.hlv_obj_tree.hlv_observer.hlv_palette.hlv_profiler.hlv_profiler_builtin.hlv_sprintf.hlv_string.hlv_style.hlv_style_gen.hlv_symbol_def.hlv_text.hlv_timer.hlv_types.h
Last updated on