lv_roller.h
API reference for lv_roller.h
Functions
lv_roller_set_options
Set the options on a roller
void lv_roller_set_options(lv_obj_t *obj, const char *options, lv_roller_mode_t mode)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to roller object |
options | const char * | a string with '<br/> ' separated options. E.g. "One\nTwo\nThree" |
mode | lv_roller_mode_t | LV_ROLLER_MODE_NORMAL or LV_ROLLER_MODE_INFINITE |
lv_roller_set_options_translation_tag
Assign a translation tag for the options of the roller. Memory will be allocated to store the tag. The options will automatically update when the language is changed via lv_translation_set_language. The translation should contain the options in a '<br/>
' separated list. E.g. "One\nTwo\nThree"
void lv_roller_set_options_translation_tag(lv_obj_t *obj, const char *tag, lv_roller_mode_t mode)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a roller object |
tag | const char * | '\0' terminated character string. |
mode | lv_roller_mode_t | LV_ROLLER_MODE_NORMAL or LV_ROLLER_MODE_INFINITE |
lv_roller_set_selected
Set the selected option
void lv_roller_set_selected(lv_obj_t *obj, uint32_t sel_opt, lv_anim_enable_t anim)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a roller object |
sel_opt | uint32_t | index of the selected option (0 ... number of option - 1); |
anim | lv_anim_enable_t | LV_ANIM_ON: set with animation; LV_ANIM_OFF set immediately |
lv_roller_set_selected_str
Sets the given string as the selection on the roller. Does not alter the current selection on failure.
bool lv_roller_set_selected_str(lv_obj_t *obj, const char *sel_opt, lv_anim_enable_t anim)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to roller object |
sel_opt | const char * | pointer to the string you want to set as an option |
anim | lv_anim_enable_t | LV_ANIM_ON: set with animation; LV_ANIM_OFF set immediately |
Returns: bool — true if set successfully and false if the given string does not exist as an option in the roller
lv_roller_set_visible_row_count
Set the height to show the given number of rows (options)
void lv_roller_set_visible_row_count(lv_obj_t *obj, uint32_t row_cnt)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a roller object |
row_cnt | uint32_t | number of desired visible rows |
lv_roller_get_selected
Get the index of the selected option
uint32_t lv_roller_get_selected(const lv_obj_t *obj)| Name | Type | Description |
|---|---|---|
obj | const lv_obj_t * | pointer to a roller object |
Returns: uint32_t — index of the selected option (0 ... number of option - 1);
lv_roller_get_selected_str
Get the current selected option as a string.
void lv_roller_get_selected_str(const lv_obj_t *obj, char *buf, uint32_t buf_size)| Name | Type | Description |
|---|---|---|
obj | const lv_obj_t * | pointer to roller object |
buf | char * | pointer to an array to store the string |
buf_size | uint32_t | size of buf in bytes. 0: to ignore it. |
lv_roller_get_options
Get the options of a roller
const char * lv_roller_get_options(const lv_obj_t *obj)| Name | Type | Description |
|---|---|---|
obj | const lv_obj_t * | pointer to roller object |
Returns: const char * — the options separated by '<br/>
'-s (E.g. "Option1\nOption2\nOption3")
lv_roller_get_option_count
Get the total number of options
uint32_t lv_roller_get_option_count(const lv_obj_t *obj)| Name | Type | Description |
|---|---|---|
obj | const lv_obj_t * | pointer to a roller object |
Returns: uint32_t — the total number of options
lv_roller_get_option_str
Get an option as a string.
lv_result_t lv_roller_get_option_str(const lv_obj_t *obj, uint32_t option, char *buf, uint32_t buf_size)| Name | Type | Description |
|---|---|---|
obj | const lv_obj_t * | pointer to roller object |
option | uint32_t | index of chosen option |
buf | char * | pointer to an array to store the string |
buf_size | uint32_t | size of buf in bytes. 0: to ignore it. |
Returns: lv_result_t — LV_RESULT_OK if option found
lv_roller_create
Create a roller object
lv_obj_t * lv_roller_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 roller
lv_roller_bind_value
Bind an integer Subject to a Roller's value.
lv_observer_t * lv_roller_bind_value(lv_obj_t *obj, lv_subject_t *subject)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to Roller |
subject | lv_subject_t * | pointer to Subject |
Returns: lv_observer_t * — pointer to newly-created Observer
Enums
lv_roller_mode_t
Roller mode.
| Name | Description |
|---|---|
LV_ROLLER_MODE_NORMAL | Normal mode (roller ends at the end of the options). |
LV_ROLLER_MODE_INFINITE | Infinite mode (roller can be scrolled forever). |
Used by 2 functions
lv_roller_set_options— parammodelv_roller_set_options_translation_tag— parammode
_lv_property_roller_id_t
| Name | Value |
|---|---|
LV_PROPERTY_ROLLER_OPTIONS | (LV_PROPERTY_ROLLER_START + ((int) 0 )) | (( 7 ) << 28 ) | (( 1 ) << 24 ) |
LV_PROPERTY_ROLLER_SELECTED | (LV_PROPERTY_ROLLER_START + ((int) 1 )) | (( 1 ) << 28 ) | (( 1 ) << 24 ) |
LV_PROPERTY_ROLLER_VISIBLE_ROW_COUNT | (LV_PROPERTY_ROLLER_START + ((int) 2 )) | (( 1 ) << 28 ) |
LV_PROPERTY_ROLLER_END |
Variables
lv_roller_class
const lv_obj_class_t lv_roller_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_class.hlv_obj_draw.hlv_obj_event.hlv_obj_pos.hlv_obj_property.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