lv_textarea.h
API reference for lv_textarea.h
Functions
lv_textarea_set_text
Set the text of a text area
void lv_textarea_set_text(lv_obj_t *obj, const char *txt)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a text area object |
txt | const char * | pointer to the text |
lv_textarea_set_placeholder_text
Set the placeholder text of a text area
void lv_textarea_set_placeholder_text(lv_obj_t *obj, const char *txt)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a text area object |
txt | const char * | pointer to the text May be NULL.. When NULL, the placeholder is removed |
lv_textarea_set_cursor_pos
Set the cursor position
void lv_textarea_set_cursor_pos(lv_obj_t *obj, int32_t pos)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a text area object |
pos | int32_t | the new cursor position in character index < 0 : index from the end of the text LV_TEXTAREA_CURSOR_LAST: go after the last character |
lv_textarea_set_cursor_click_pos
Enable/Disable the positioning of the cursor by clicking the text on the text area.
void lv_textarea_set_cursor_click_pos(lv_obj_t *obj, bool en)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a text area object |
en | bool | true: enable click positions; false: disable |
lv_textarea_set_password_mode
Enable/Disable password mode
void lv_textarea_set_password_mode(lv_obj_t *obj, bool en)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a text area object |
en | bool | true: enable, false: disable |
lv_textarea_set_password_bullet
Set the replacement characters to show in password mode
void lv_textarea_set_password_bullet(lv_obj_t *obj, const char *bullet)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a text area object |
bullet | const char * | pointer to the replacement text May be NULL.. When NULL the default bullet icon is used |
lv_textarea_set_one_line
Configure the text area to one line or back to normal
void lv_textarea_set_one_line(lv_obj_t *obj, bool en)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a text area object |
en | bool | true: one line, false: normal |
lv_textarea_set_accepted_chars
Set a list of characters. Only these characters will be accepted by the text area
void lv_textarea_set_accepted_chars(lv_obj_t *obj, const char *list)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a text area object |
list | const char * | list of characters. A copy is saved. May be NULL.. When NULL the list is removed and every character is accepted by default. Example: "+-.,0123456789" |
lv_textarea_set_accepted_chars_static
Set a list of characters. Only these characters will be accepted by the text area
void lv_textarea_set_accepted_chars_static(lv_obj_t *obj, const char *list)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a text area object |
list | const char * | list of characters. It must outlive the widget. May be NULL.. When NULL the list is removed and every character is accepted by default. Example: "+-.,0123456789" |
lv_textarea_set_max_length
Set max length of a Text Area.
void lv_textarea_set_max_length(lv_obj_t *obj, uint32_t num)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a text area object |
num | uint32_t | the maximal number of characters can be added (lv_textarea_set_text ignores it) |
lv_textarea_set_insert_replace
In LV_EVENT_INSERT the text which planned to be inserted can be replaced by another text. It can be used to add automatic formatting to the text area.
void lv_textarea_set_insert_replace(lv_obj_t *obj, const char *txt)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a text area object |
txt | const char * | pointer to a new string to insert. May be NULL. If "" or NULL no text will be added. The variable must be live after the event_cb exists. (Should be global or static) |
lv_textarea_set_text_selection
Enable/disable selection mode.
void lv_textarea_set_text_selection(lv_obj_t *obj, bool en)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a text area object |
en | bool | true or false to enable/disable selection mode |
lv_textarea_set_password_show_time
Set how long show the password before changing it to '*'
void lv_textarea_set_password_show_time(lv_obj_t *obj, uint32_t time)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a text area object |
time | uint32_t | show time in milliseconds. 0: hide immediately. |
lv_textarea_set_align
> Deprecated: Use the normal text_align style property instead Set the label's alignment. It sets where the label is aligned (in one line mode it can be smaller than the text area) and how the lines of the area align in case of multiline text area
void lv_textarea_set_align(lv_obj_t *obj, lv_text_align_t align)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a text area object |
align | lv_text_align_t | the align mode from lv_text_align_t |
lv_textarea_get_text
Get the text of a text area. In password mode it gives the real text (not '*'s).
const char * lv_textarea_get_text(const lv_obj_t *obj)| Name | Type | Description |
|---|---|---|
obj | const lv_obj_t * | pointer to a text area object |
Returns: const char * — pointer to the text
lv_textarea_get_placeholder_text
Get the placeholder text of a text area
const char * lv_textarea_get_placeholder_text(lv_obj_t *obj)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a text area object |
Returns: const char * — pointer to the text
lv_textarea_get_label
Get the label of a text area
lv_obj_t * lv_textarea_get_label(const lv_obj_t *obj)| Name | Type | Description |
|---|---|---|
obj | const lv_obj_t * | pointer to a text area object |
Returns: lv_obj_t * — pointer to the label object
lv_textarea_get_cursor_pos
Get the current cursor position in character index
uint32_t lv_textarea_get_cursor_pos(const lv_obj_t *obj)| Name | Type | Description |
|---|---|---|
obj | const lv_obj_t * | pointer to a text area object |
Returns: uint32_t — the cursor position
lv_textarea_get_cursor_click_pos
Get whether the cursor click positioning is enabled or not.
bool lv_textarea_get_cursor_click_pos(lv_obj_t *obj)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a text area object |
Returns: bool — true: enable click positions; false: disable
lv_textarea_get_password_mode
Get the password mode attribute
bool lv_textarea_get_password_mode(const lv_obj_t *obj)| Name | Type | Description |
|---|---|---|
obj | const lv_obj_t * | pointer to a text area object |
Returns: bool — true: password mode is enabled, false: disabled
lv_textarea_get_password_bullet
Get the replacement characters to show in password mode
const char * lv_textarea_get_password_bullet(lv_obj_t *obj)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a text area object |
Returns: const char * — pointer to the replacement text
lv_textarea_get_one_line
Get the one line configuration attribute
bool lv_textarea_get_one_line(const lv_obj_t *obj)| Name | Type | Description |
|---|---|---|
obj | const lv_obj_t * | pointer to a text area object |
Returns: bool — true: one line configuration is enabled, false: disabled
lv_textarea_get_accepted_chars
Get a list of accepted characters.
const char * lv_textarea_get_accepted_chars(lv_obj_t *obj)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a text area object |
Returns: const char * — list of accented characters.
lv_textarea_get_max_length
Get max length of a Text Area.
uint32_t lv_textarea_get_max_length(lv_obj_t *obj)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a text area object |
Returns: uint32_t — the maximal number of characters to be add
lv_textarea_get_text_selection
Find whether selection mode is enabled.
bool lv_textarea_get_text_selection(lv_obj_t *obj)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a text area object |
Returns: bool — true: selection mode is enabled, false: disabled
lv_textarea_get_password_show_time
Set how long show the password before changing it to '*'
uint32_t lv_textarea_get_password_show_time(lv_obj_t *obj)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a text area object |
Returns: uint32_t — show time in milliseconds. 0: hide immediately.
lv_textarea_get_current_char
Get a the character from the current cursor position
uint32_t lv_textarea_get_current_char(lv_obj_t *obj)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a text area object |
Returns: uint32_t — a the character or 0
lv_textarea_create
Create a text area object
lv_obj_t * lv_textarea_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 text area
lv_textarea_add_char
Insert a character to the current cursor position. To add a wide char, e.g. 'Á' use ‘lv_text_encoded_conv_wc('Á’)‘
void lv_textarea_add_char(lv_obj_t *obj, uint32_t c)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a text area object |
c | uint32_t | a character (e.g. 'a’) |
lv_textarea_add_text
Insert a text to the current cursor position
void lv_textarea_add_text(lv_obj_t *obj, const char *txt)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a text area object |
txt | const char * | a '\0' terminated string to insert |
lv_textarea_delete_char
Delete a the left character from the current cursor position
void lv_textarea_delete_char(lv_obj_t *obj)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a text area object |
lv_textarea_delete_char_forward
Delete the right character from the current cursor position
void lv_textarea_delete_char_forward(lv_obj_t *obj)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a text area object |
lv_textarea_text_is_selected
Find whether text is selected or not.
bool lv_textarea_text_is_selected(const lv_obj_t *obj)| Name | Type | Description |
|---|---|---|
obj | const lv_obj_t * | pointer to a text area object |
Returns: bool — whether text is selected or not
lv_textarea_clear_selection
Clear the selection on the text area.
void lv_textarea_clear_selection(lv_obj_t *obj)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a text area object |
lv_textarea_cursor_right
Move the cursor one character right
void lv_textarea_cursor_right(lv_obj_t *obj)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a text area object |
lv_textarea_cursor_left
Move the cursor one character left
void lv_textarea_cursor_left(lv_obj_t *obj)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a text area object |
lv_textarea_cursor_down
Move the cursor one line down
void lv_textarea_cursor_down(lv_obj_t *obj)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a text area object |
lv_textarea_cursor_up
Move the cursor one line up
void lv_textarea_cursor_up(lv_obj_t *obj)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a text area object |
Enums
_lv_property_textarea_id_t
| Name | Value |
|---|---|
LV_PROPERTY_TEXTAREA_TEXT | (LV_PROPERTY_TEXTAREA_START + ((int) 0 )) | (( 7 ) << 28 ) |
LV_PROPERTY_TEXTAREA_PLACEHOLDER_TEXT | (LV_PROPERTY_TEXTAREA_START + ((int) 1 )) | (( 7 ) << 28 ) |
LV_PROPERTY_TEXTAREA_CURSOR_POS | (LV_PROPERTY_TEXTAREA_START + ((int) 2 )) | (( 1 ) << 28 ) |
LV_PROPERTY_TEXTAREA_CURSOR_CLICK_POS | (LV_PROPERTY_TEXTAREA_START + ((int) 3 )) | (( 1 ) << 28 ) |
LV_PROPERTY_TEXTAREA_PASSWORD_MODE | (LV_PROPERTY_TEXTAREA_START + ((int) 4 )) | (( 1 ) << 28 ) |
LV_PROPERTY_TEXTAREA_PASSWORD_BULLET | (LV_PROPERTY_TEXTAREA_START + ((int) 5 )) | (( 7 ) << 28 ) |
LV_PROPERTY_TEXTAREA_ONE_LINE | (LV_PROPERTY_TEXTAREA_START + ((int) 6 )) | (( 11 ) << 28 ) |
LV_PROPERTY_TEXTAREA_ACCEPTED_CHARS | (LV_PROPERTY_TEXTAREA_START + ((int) 7 )) | (( 7 ) << 28 ) |
LV_PROPERTY_TEXTAREA_MAX_LENGTH | (LV_PROPERTY_TEXTAREA_START + ((int) 8 )) | (( 1 ) << 28 ) |
LV_PROPERTY_TEXTAREA_TEXT_SELECTION | (LV_PROPERTY_TEXTAREA_START + ((int) 9 )) | (( 11 ) << 28 ) |
LV_PROPERTY_TEXTAREA_PASSWORD_SHOW_TIME | (LV_PROPERTY_TEXTAREA_START + ((int) 10 )) | (( 1 ) << 28 ) |
LV_PROPERTY_TEXTAREA_LABEL | (LV_PROPERTY_TEXTAREA_START + ((int) 11 )) | (( 8 ) << 28 ) |
LV_PROPERTY_TEXTAREA_TEXT_IS_SELECTED | (LV_PROPERTY_TEXTAREA_START + ((int) 12 )) | (( 1 ) << 28 ) |
LV_PROPERTY_TEXTAREA_CURRENT_CHAR | (LV_PROPERTY_TEXTAREA_START + ((int) 13 )) | (( 1 ) << 28 ) |
LV_PROPERTY_TEXTAREA_END |
Macros
LV_TEXTAREA_CURSOR_LAST
#define LV_TEXTAREA_CURSOR_LAST (0x7FFF) /*Put the cursor after the last character*/LV_PART_TEXTAREA_PLACEHOLDER
#define LV_PART_TEXTAREA_PLACEHOLDER LV_PART_CUSTOM_FIRSTVariables
lv_textarea_class
const lv_obj_class_t lv_textarea_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.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