lv_roller.h

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).

enum [anonymous]

Values:

enumerator LV_PROPERTY_ROLLER_OPTIONS
enumerator LV_PROPERTY_ROLLER_SELECTED
enumerator LV_PROPERTY_ROLLER_VISIBLE_ROW_COUNT
enumerator LV_PROPERTY_ROLLER_END

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"

  • modeLV_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 roller object

  • buf – pointer to an array to store the string

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

bool lv_roller_set_selected_str(lv_obj_t *obj, const char *sel_opt, lv_anim_enable_t anim)

Sets the given string as the selection on the roller. Does not alter the current selection on failure.

Parameters:
  • obj – pointer to roller object

  • sel_opt – pointer to the string you want to set as an option

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

Returns:

true if set successfully and false if the given string does not exist as an option in the roller

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