lv_dropdown.h
API reference for lv_dropdown.h
Functions
lv_dropdown_set_text
Set text of the drop-down list's button. If set to NULL the selected option's text will be displayed on the button. If set to a specific text then that text will be shown regardless of the selected option.
void lv_dropdown_set_text(lv_obj_t *obj, const char *text)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a drop-down list object |
text | const char * | the text as a string (Copy is saved). May be NULL. When NULL the selected option's text is displayed. |
lv_dropdown_set_text_static
Set text of the drop-down list's button. If set to NULL the selected option's text will be displayed on the button. If set to a specific text then that text will be shown regardless of the selected option.
void lv_dropdown_set_text_static(lv_obj_t *obj, const char *text)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a drop-down list object |
text | const char * | the text as a string (Only its pointer is saved). May be NULL. When NULL the selected option's text is displayed. |
lv_dropdown_set_text_translation_tag
Assign a translation tag for the drop-down list's button text. Memory will be allocated to store the tag. The button text will automatically update when the language is changed via lv_translation_set_language.
void lv_dropdown_set_text_translation_tag(lv_obj_t *obj, const char *tag)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a drop-down list object |
tag | const char * | '\0' terminated character string. |
lv_dropdown_set_options
Set the options in a drop-down list from a string. The options will be copied and saved in the object so the options can be destroyed after calling this function
void lv_dropdown_set_options(lv_obj_t *obj, const char *options)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to drop-down list object |
options | const char * | a string with '<br/> ' separated options. E.g. "One\nTwo\nThree" |
lv_dropdown_set_options_static
Set the options in a drop-down list from a static string (global, static or dynamically allocated). Only the pointer of the option string will be saved.
void lv_dropdown_set_options_static(lv_obj_t *obj, const char *options)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to drop-down list object |
options | const char * | a static string with '<br/> ' separated options. E.g. "One\nTwo\nThree" |
lv_dropdown_set_options_translation_tag
Assign a translation tag for the options of the drop-down list. 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_dropdown_set_options_translation_tag(lv_obj_t *obj, const char *tag)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a drop-down list object |
tag | const char * | '\0' terminated character string. |
lv_dropdown_set_selected
Set the selected option
void lv_dropdown_set_selected(lv_obj_t *obj, uint32_t sel_opt)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to drop-down list object |
sel_opt | uint32_t | id of the selected option (0 ... number of option - 1); |
lv_dropdown_set_dir
Set the direction of the a drop-down list
void lv_dropdown_set_dir(lv_obj_t *obj, lv_dir_t dir)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a drop-down list object |
dir | lv_dir_t | LV_DIR_LEFT/RIGHT/TOP/BOTTOM |
lv_dropdown_set_symbol
Set an arrow or other symbol to display when on drop-down list's button. Typically a down caret or arrow.
void lv_dropdown_set_symbol(lv_obj_t *obj, const void *symbol)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to drop-down list object |
symbol | const void * | a text like LV_SYMBOL_DOWN or an image (pointer or path). May be NULL. When NULL no symbol icon is drawn. |
angle and zoom transformation can be applied if the symbol is an image. E.g. when drop down is checked (opened) rotate the symbol by 180 degree
lv_dropdown_set_selected_highlight
Set whether the selected option in the list should be highlighted or not
void lv_dropdown_set_selected_highlight(lv_obj_t *obj, bool en)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to drop-down list object |
en | bool | true: highlight enabled; false: disabled |
lv_dropdown_get_list
Get the list of a drop-down to allow styling or other modifications
lv_obj_t * lv_dropdown_get_list(lv_obj_t *obj)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a drop-down list object |
Returns: lv_obj_t * — pointer to the list of the drop-down
lv_dropdown_get_text
Get text of the drop-down list's button.
const char * lv_dropdown_get_text(lv_obj_t *obj)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a drop-down list object |
Returns: const char * — the text as string, NULL if no text
lv_dropdown_get_options
Get the options of a drop-down list
const char * lv_dropdown_get_options(const lv_obj_t *obj)| Name | Type | Description |
|---|---|---|
obj | const lv_obj_t * | pointer to drop-down list object |
Returns: const char * — the options separated by '<br/>
'-s (E.g. "Option1\nOption2\nOption3")
lv_dropdown_get_selected
Get the index of the selected option
uint32_t lv_dropdown_get_selected(const lv_obj_t *obj)| Name | Type | Description |
|---|---|---|
obj | const lv_obj_t * | pointer to drop-down list object |
Returns: uint32_t — index of the selected option (0 ... number of option - 1);
lv_dropdown_get_option_count
Get the total number of options
uint32_t lv_dropdown_get_option_count(const lv_obj_t *obj)| Name | Type | Description |
|---|---|---|
obj | const lv_obj_t * | pointer to drop-down list object |
Returns: uint32_t — the total number of options in the list
lv_dropdown_get_selected_str
Get the current selected option as a string
void lv_dropdown_get_selected_str(const lv_obj_t *obj, char *buf, uint32_t buf_size)| Name | Type | Description |
|---|---|---|
obj | const lv_obj_t * | pointer to drop-down 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_dropdown_get_option_index
Get the index of an option.
int32_t lv_dropdown_get_option_index(lv_obj_t *obj, const char *option)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to drop-down object |
option | const char * | an option as string |
Returns: int32_t — index of option in the list of all options. -1 if not found.
lv_dropdown_get_symbol
Get the symbol on the drop-down list. Typically a down caret or arrow.
const char * lv_dropdown_get_symbol(lv_obj_t *obj)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to drop-down list object |
Returns: const char * — the symbol or NULL if not enabled
lv_dropdown_get_selected_highlight
Get whether the selected option in the list should be highlighted or not
bool lv_dropdown_get_selected_highlight(lv_obj_t *obj)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to drop-down list object |
Returns: bool — true: highlight enabled; false: disabled
lv_dropdown_get_dir
Get the direction of the drop-down list
lv_dir_t lv_dropdown_get_dir(const lv_obj_t *obj)| Name | Type | Description |
|---|---|---|
obj | const lv_obj_t * | pointer to a drop-down list object |
Returns: lv_dir_t — LV_DIR_LEF/RIGHT/TOP/BOTTOM
lv_dropdown_create
Create a drop-down list object
lv_obj_t * lv_dropdown_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 drop-down list
lv_dropdown_add_option
Add an options to a drop-down list from a string. Only works for non-static options.
void lv_dropdown_add_option(lv_obj_t *obj, const char *option, uint32_t pos)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to drop-down list object |
option | const char * | a string without '<br/> '. E.g. "Four" |
pos | uint32_t | the insert position, indexed from 0, LV_DROPDOWN_POS_LAST = end of string |
lv_dropdown_clear_options
Clear all options in a drop-down list. Works with both static and dynamic options.
void lv_dropdown_clear_options(lv_obj_t *obj)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to drop-down list object |
lv_dropdown_open
Open the drop.down list
void lv_dropdown_open(lv_obj_t *dropdown_obj)| Name | Type | Description |
|---|---|---|
dropdown_obj | lv_obj_t * | pointer to drop-down list object |
lv_dropdown_close
Close (Collapse) the drop-down list
void lv_dropdown_close(lv_obj_t *obj)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to drop-down list object |
lv_dropdown_is_open
Tells whether the list is opened or not
bool lv_dropdown_is_open(lv_obj_t *obj)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a drop-down list object |
Returns: bool — true if the list os opened
lv_dropdown_bind_value
Bind an integer Subject to a Dropdown's value.
lv_observer_t * lv_dropdown_bind_value(lv_obj_t *obj, lv_subject_t *subject)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to Dropdown |
subject | lv_subject_t * | pointer to Subject |
Returns: lv_observer_t * — pointer to newly-created Observer
Enums
_lv_property_dropdown_id_t
| Name | Value |
|---|---|
LV_PROPERTY_DROPDOWN_TEXT | (LV_PROPERTY_DROPDOWN_START + ((int) 0 )) | (( 7 ) << 28 ) |
LV_PROPERTY_DROPDOWN_OPTIONS | (LV_PROPERTY_DROPDOWN_START + ((int) 1 )) | (( 7 ) << 28 ) |
LV_PROPERTY_DROPDOWN_OPTION_COUNT | (LV_PROPERTY_DROPDOWN_START + ((int) 2 )) | (( 1 ) << 28 ) |
LV_PROPERTY_DROPDOWN_SELECTED | (LV_PROPERTY_DROPDOWN_START + ((int) 3 )) | (( 1 ) << 28 ) |
LV_PROPERTY_DROPDOWN_DIR | (LV_PROPERTY_DROPDOWN_START + ((int) 5 )) | (( 1 ) << 28 ) |
LV_PROPERTY_DROPDOWN_SYMBOL | (LV_PROPERTY_DROPDOWN_START + ((int) 6 )) | (( 6 ) << 28 ) |
LV_PROPERTY_DROPDOWN_SELECTED_HIGHLIGHT | (LV_PROPERTY_DROPDOWN_START + ((int) 7 )) | (( 1 ) << 28 ) |
LV_PROPERTY_DROPDOWN_LIST | (LV_PROPERTY_DROPDOWN_START + ((int) 8 )) | (( 8 ) << 28 ) |
LV_PROPERTY_DROPDOWN_IS_OPEN | (LV_PROPERTY_DROPDOWN_START + ((int) 9 )) | (( 11 ) << 28 ) |
LV_PROPERTY_DROPDOWN_END |
Macros
LV_DROPDOWN_POS_LAST
#define LV_DROPDOWN_POS_LAST 0xFFFFVariables
lv_dropdown_class
const lv_obj_class_t lv_dropdown_classlv_dropdownlist_class
const lv_obj_class_t lv_dropdownlist_classDependencies
Indirect dependencies
lv_anim.hlv_area.hlv_assert.hlv_bidi.hlv_color.hlv_color_op.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_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