lv_table.h

Defines

LV_TABLE_CELL_NONE

Typedefs

typedef _lv_table_cell_ctrl_t lv_table_cell_ctrl_t

Enums

enum _lv_table_cell_ctrl_t

Values:

enumerator LV_TABLE_CELL_CTRL_MERGE_RIGHT
enumerator LV_TABLE_CELL_CTRL_TEXT_CROP
enumerator LV_TABLE_CELL_CTRL_CUSTOM_1
enumerator LV_TABLE_CELL_CTRL_CUSTOM_2
enumerator LV_TABLE_CELL_CTRL_CUSTOM_3
enumerator LV_TABLE_CELL_CTRL_CUSTOM_4

Functions

lv_obj_t *lv_table_create(lv_obj_t *parent)

Create a table object

Parameters:

parent -- pointer to an object, it will be the parent of the new table

Returns:

pointer to the created table

void lv_table_set_cell_value(lv_obj_t *obj, uint32_t row, uint32_t col, const char *txt)

Set the value of a cell.

Note

New roes/columns are added automatically if required

Parameters:
  • obj -- pointer to a Table object

  • row -- id of the row [0 .. row_cnt -1]

  • col -- id of the column [0 .. col_cnt -1]

  • txt -- text to display in the cell. It will be copied and saved so this variable is not required after this function call.

void lv_table_set_cell_value_fmt(lv_obj_t *obj, uint32_t row, uint32_t col, const char *fmt, ...)

Set the value of a cell. Memory will be allocated to store the text by the table.

Note

New roes/columns are added automatically if required

Parameters:
  • obj -- pointer to a Table object

  • row -- id of the row [0 .. row_cnt -1]

  • col -- id of the column [0 .. col_cnt -1]

  • fmt -- printf-like format

void lv_table_set_row_cnt(lv_obj_t *obj, uint32_t row_cnt)

Set the number of rows

Parameters:
  • obj -- table pointer to a Table object

  • row_cnt -- number of rows

void lv_table_set_col_cnt(lv_obj_t *obj, uint32_t col_cnt)

Set the number of columns

Parameters:
  • obj -- table pointer to a Table object

  • col_cnt -- number of columns.

void lv_table_set_col_width(lv_obj_t *obj, uint32_t col_id, lv_coord_t w)

Set the width of a column

Parameters:
  • obj -- table pointer to a Table object

  • col_id -- id of the column [0 .. LV_TABLE_COL_MAX -1]

  • w -- width of the column

void lv_table_add_cell_ctrl(lv_obj_t *obj, uint32_t row, uint32_t col, lv_table_cell_ctrl_t ctrl)

Add control bits to the cell.

Parameters:
  • obj -- pointer to a Table object

  • row -- id of the row [0 .. row_cnt -1]

  • col -- id of the column [0 .. col_cnt -1]

  • ctrl -- OR-ed values from ::lv_table_cell_ctrl_t

void lv_table_clear_cell_ctrl(lv_obj_t *obj, uint32_t row, uint32_t col, lv_table_cell_ctrl_t ctrl)

Clear control bits of the cell.

Parameters:
  • obj -- pointer to a Table object

  • row -- id of the row [0 .. row_cnt -1]

  • col -- id of the column [0 .. col_cnt -1]

  • ctrl -- OR-ed values from ::lv_table_cell_ctrl_t

const char *lv_table_get_cell_value(lv_obj_t *obj, uint32_t row, uint32_t col)

Get the value of a cell.

Parameters:
  • obj -- pointer to a Table object

  • row -- id of the row [0 .. row_cnt -1]

  • col -- id of the column [0 .. col_cnt -1]

Returns:

text in the cell

uint32_t lv_table_get_row_cnt(lv_obj_t *obj)

Get the number of rows.

Parameters:

obj -- table pointer to a Table object

Returns:

number of rows.

uint32_t lv_table_get_col_cnt(lv_obj_t *obj)

Get the number of columns.

Parameters:

obj -- table pointer to a Table object

Returns:

number of columns.

lv_coord_t lv_table_get_col_width(lv_obj_t *obj, uint32_t col)

Get the width of a column

Parameters:
  • obj -- table pointer to a Table object

  • col -- id of the column [0 .. LV_TABLE_COL_MAX -1]

Returns:

width of the column

bool lv_table_has_cell_ctrl(lv_obj_t *obj, uint32_t row, uint32_t col, lv_table_cell_ctrl_t ctrl)

Get whether a cell has the control bits

Parameters:
  • obj -- pointer to a Table object

  • row -- id of the row [0 .. row_cnt -1]

  • col -- id of the column [0 .. col_cnt -1]

  • ctrl -- OR-ed values from ::lv_table_cell_ctrl_t

Returns:

true: all control bits are set; false: not all control bits are set

void lv_table_get_selected_cell(lv_obj_t *obj, uint32_t *row, uint32_t *col)

Get the selected cell (pressed and or focused)

Parameters:
  • obj -- pointer to a table object

  • row -- pointer to variable to store the selected row (LV_TABLE_CELL_NONE: if no cell selected)

  • col -- pointer to variable to store the selected column (LV_TABLE_CELL_NONE: if no cell selected)

Variables

const lv_obj_class_t lv_table_class
struct lv_table_t

Public Members

lv_obj_t obj
uint32_t col_cnt
uint32_t row_cnt
char **cell_data
lv_coord_t *row_h
lv_coord_t *col_w
uint32_t col_act
uint32_t row_act