lv_textarea.h
Defines
-
LV_TEXTAREA_CURSOR_LAST
Functions
-
lv_obj_t *lv_textarea_create(lv_obj_t *parent)
Create a text area object
- Parameters:
parent -- pointer to an object, it will be the parent of the new text area
- Returns:
pointer to the created text area
-
void lv_textarea_add_char(lv_obj_t *obj, uint32_t c)
Insert a character to the current cursor position. To add a wide char, e.g. 'Á' use _lv_text_encoded_conv_wc('Á)`
- Parameters:
obj -- pointer to a text area object
c -- a character (e.g. 'a')
-
void lv_textarea_add_text(lv_obj_t *obj, const char *txt)
Insert a text to the current cursor position
- Parameters:
obj -- pointer to a text area object
txt -- a '\0' terminated string to insert
-
void lv_textarea_delete_char(lv_obj_t *obj)
Delete a the left character from the current cursor position
- Parameters:
obj -- pointer to a text area object
-
void lv_textarea_delete_char_forward(lv_obj_t *obj)
Delete the right character from the current cursor position
- Parameters:
obj -- pointer to a text area object
-
void lv_textarea_set_text(lv_obj_t *obj, const char *txt)
Set the text of a text area
- Parameters:
obj -- pointer to a text area object
txt -- pointer to the text
-
void lv_textarea_set_placeholder_text(lv_obj_t *obj, const char *txt)
Set the placeholder text of a text area
- Parameters:
obj -- pointer to a text area object
txt -- pointer to the text
-
void lv_textarea_set_cursor_pos(lv_obj_t *obj, int32_t pos)
Set the cursor position
- Parameters:
obj -- pointer to a text area object
pos -- the new cursor position in character index < 0 : index from the end of the text LV_TEXTAREA_CURSOR_LAST: go after the last character
-
void lv_textarea_set_cursor_click_pos(lv_obj_t *obj, bool en)
Enable/Disable the positioning of the cursor by clicking the text on the text area.
- Parameters:
obj -- pointer to a text area object
en -- true: enable click positions; false: disable
-
void lv_textarea_set_password_mode(lv_obj_t *obj, bool en)
Enable/Disable password mode
- Parameters:
obj -- pointer to a text area object
en -- true: enable, false: disable
-
void lv_textarea_set_password_bullet(lv_obj_t *obj, const char *bullet)
Set the replacement characters to show in password mode
- Parameters:
obj -- pointer to a text area object
bullet -- pointer to the replacement text
-
void lv_textarea_set_one_line(lv_obj_t *obj, bool en)
Configure the text area to one line or back to normal
- Parameters:
obj -- pointer to a text area object
en -- true: one line, false: normal
-
void lv_textarea_set_accepted_chars(lv_obj_t *obj, const char *list)
Set a list of characters. Only these characters will be accepted by the text area
- Parameters:
obj -- pointer to a text area object
list -- list of characters. Only the pointer is saved. E.g. "+-.,0123456789"
-
void lv_textarea_set_max_length(lv_obj_t *obj, uint32_t num)
Set max length of a Text Area.
- Parameters:
obj -- pointer to a text area object
num -- the maximal number of characters can be added (
lv_textarea_set_text
ignores it)
-
void lv_textarea_set_insert_replace(lv_obj_t *obj, const char *txt)
In
LV_EVENT_INSERT
the text which planned to be inserted can be replaced by an other text. It can be used to add automatic formatting to the text area.- Parameters:
obj -- pointer to a text area object
txt -- pointer to a new string to insert. If
""
no text will be added. The variable must be live after theevent_cb
exists. (Should beglobal
orstatic
)
-
void lv_textarea_set_text_selection(lv_obj_t *obj, bool en)
Enable/disable selection mode.
- Parameters:
obj -- pointer to a text area object
en -- true or false to enable/disable selection mode
-
void lv_textarea_set_password_show_time(lv_obj_t *obj, uint32_t time)
Set how long show the password before changing it to '*'
- Parameters:
obj -- pointer to a text area object
time -- show time in milliseconds. 0: hide immediately.
-
void lv_textarea_set_align(lv_obj_t *obj, lv_text_align_t 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
- Parameters:
obj -- pointer to a text area object
align -- the align mode from ::lv_text_align_t
-
const char *lv_textarea_get_text(const lv_obj_t *obj)
Get the text of a text area. In password mode it gives the real text (not '*'s).
- Parameters:
obj -- pointer to a text area object
- Returns:
pointer to the text
-
const char *lv_textarea_get_placeholder_text(lv_obj_t *obj)
Get the placeholder text of a text area
- Parameters:
obj -- pointer to a text area object
- Returns:
pointer to the text
-
lv_obj_t *lv_textarea_get_label(const lv_obj_t *obj)
Get the label of a text area
- Parameters:
obj -- pointer to a text area object
- Returns:
pointer to the label object
-
uint32_t lv_textarea_get_cursor_pos(const lv_obj_t *obj)
Get the current cursor position in character index
- Parameters:
obj -- pointer to a text area object
- Returns:
the cursor position
-
bool lv_textarea_get_cursor_click_pos(lv_obj_t *obj)
Get whether the cursor click positioning is enabled or not.
- Parameters:
obj -- pointer to a text area object
- Returns:
true: enable click positions; false: disable
-
bool lv_textarea_get_password_mode(const lv_obj_t *obj)
Get the password mode attribute
- Parameters:
obj -- pointer to a text area object
- Returns:
true: password mode is enabled, false: disabled
-
const char *lv_textarea_get_password_bullet(lv_obj_t *obj)
Get the replacement characters to show in password mode
- Parameters:
obj -- pointer to a text area object
- Returns:
pointer to the replacement text
-
bool lv_textarea_get_one_line(const lv_obj_t *obj)
Get the one line configuration attribute
- Parameters:
obj -- pointer to a text area object
- Returns:
true: one line configuration is enabled, false: disabled
-
const char *lv_textarea_get_accepted_chars(lv_obj_t *obj)
Get a list of accepted characters.
- Parameters:
obj -- pointer to a text area object
- Returns:
list of accented characters.
-
uint32_t lv_textarea_get_max_length(lv_obj_t *obj)
Get max length of a Text Area.
- Parameters:
obj -- pointer to a text area object
- Returns:
the maximal number of characters to be add
-
bool lv_textarea_text_is_selected(const lv_obj_t *obj)
Find whether text is selected or not.
- Parameters:
obj -- pointer to a text area object
- Returns:
whether text is selected or not
-
bool lv_textarea_get_text_selection(lv_obj_t *obj)
Find whether selection mode is enabled.
- Parameters:
obj -- pointer to a text area object
- Returns:
true: selection mode is enabled, false: disabled
-
uint32_t lv_textarea_get_password_show_time(lv_obj_t *obj)
Set how long show the password before changing it to '*'
- Parameters:
obj -- pointer to a text area object
- Returns:
show time in milliseconds. 0: hide immediately.
-
uint32_t lv_textarea_get_current_char(lv_obj_t *obj)
Get a the character from the current cursor position
- Parameters:
obj -- pointer to a text area object
- Returns:
a the character or 0
-
void lv_textarea_clear_selection(lv_obj_t *obj)
Clear the selection on the text area.
- Parameters:
obj -- pointer to a text area object
-
void lv_textarea_cursor_right(lv_obj_t *obj)
Move the cursor one character right
- Parameters:
obj -- pointer to a text area object
-
void lv_textarea_cursor_left(lv_obj_t *obj)
Move the cursor one character left
- Parameters:
obj -- pointer to a text area object
Variables
-
const lv_obj_class_t lv_textarea_class
-
struct lv_textarea_t
Public Members
-
char *placeholder_txt
-
char *pwd_tmp
-
char *pwd_bullet
-
const char *accepted_chars
-
uint32_t max_length
-
uint32_t pwd_show_time
-
lv_coord_t valid_x
-
uint32_t pos
-
uint32_t txt_byte_pos
-
uint8_t show
-
uint8_t click_pos
-
struct lv_textarea_t::[anonymous] cursor
-
uint32_t sel_start
-
uint32_t sel_end
-
uint8_t text_sel_in_prog
-
uint8_t text_sel_en
-
uint8_t pwd_mode
-
uint8_t one_line
-
char *placeholder_txt