lv_roller.h

Typedefs

typedef _lv_roller_mode_t lv_roller_mode_t

Enums

enum _lv_roller_mode_t

Roller mode.

Values:

enumerator LV_ROLLER_MODE_NORMAL

Normal mode (roller ends at the end of the options).

enumerator LV_ROLLER_MODE_INFINITE

Infinite mode (roller can be scrolled forever).

Functions

lv_obj_t *lv_roller_create(lv_obj_t *parent)

Create a roller object

Parameters:

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

Returns:

pointer to the created roller

void lv_roller_set_options(lv_obj_t *obj, const char *options, lv_roller_mode_t mode)

Set the options on a roller

Parameters:
  • obj -- pointer to roller object

  • options --

    a string with '

    ' separated options. E.g. "One\nTwo\nThree"

  • mode -- LV_ROLLER_MODE_NORMAL or LV_ROLLER_MODE_INFINITE

void lv_roller_set_selected(lv_obj_t *obj, uint32_t sel_opt, lv_anim_enable_t anim)

Set the selected option

Parameters:
  • obj -- pointer to a roller object

  • sel_opt -- index of the selected option (0 ... number of option - 1);

  • anim -- LV_ANIM_ON: set with animation; LV_ANOM_OFF set immediately

void lv_roller_set_visible_row_count(lv_obj_t *obj, uint32_t row_cnt)

Set the height to show the given number of rows (options)

Parameters:
  • obj -- pointer to a roller object

  • row_cnt -- number of desired visible rows

uint32_t lv_roller_get_selected(const lv_obj_t *obj)

Get the index of the selected option

Parameters:

obj -- pointer to a roller object

Returns:

index of the selected option (0 ... number of option - 1);

void lv_roller_get_selected_str(const lv_obj_t *obj, char *buf, uint32_t buf_size)

Get the current selected option as a string.

Parameters:
  • obj -- pointer to ddlist object

  • buf -- pointer to an array to store the string

  • buf_size -- size of buf in bytes. 0: to ignore it.

const char *lv_roller_get_options(const lv_obj_t *obj)

Get the options of a roller

Parameters:

obj -- pointer to roller object

Returns:

the options separated by '

'-s (E.g. "Option1\nOption2\nOption3")

uint32_t lv_roller_get_option_count(const lv_obj_t *obj)

Get the total number of options

Parameters:

obj -- pointer to a roller object

Returns:

the total number of options

Variables

const lv_obj_class_t lv_roller_class
struct lv_roller_t

Public Members

lv_obj_t obj
uint32_t option_cnt

Number of options

uint32_t sel_opt_id

Index of the current option

uint32_t sel_opt_id_ori

Store the original index on focus

uint32_t inf_page_cnt

Number of extra pages added to make the roller look infinite

lv_roller_mode_t mode
uint32_t moved