lv_textarea.h

Defines

LV_TEXTAREA_CURSOR_LAST

Enums

enum [anonymous]

Values:

enumerator LV_PART_TEXTAREA_PLACEHOLDER

Functions

lv_obj_t *lv_textarea_create(lv_obj_t *parent)

Create a text area object

参数:

parent -- pointer to an object, it will be the parent of the new text area

返回:

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('Á)`

参数:
  • 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

参数:
  • 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

参数:

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

参数:

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

参数:
  • 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

参数:
  • 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

参数:
  • 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.

参数:
  • 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

参数:
  • 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

参数:
  • 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

参数:
  • 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

参数:
  • 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.

参数:
  • 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 another text. It can be used to add automatic formatting to the text area.

参数:
  • 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 the event_cb exists. (Should be global or static)

void lv_textarea_set_text_selection(lv_obj_t *obj, bool en)

Enable/disable selection mode.

参数:
  • 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 '*'

参数:
  • 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

参数:
  • 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).

参数:

obj -- pointer to a text area object

返回:

pointer to the text

const char *lv_textarea_get_placeholder_text(lv_obj_t *obj)

Get the placeholder text of a text area

参数:

obj -- pointer to a text area object

返回:

pointer to the text

lv_obj_t *lv_textarea_get_label(const lv_obj_t *obj)

Get the label of a text area

参数:

obj -- pointer to a text area object

返回:

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

参数:

obj -- pointer to a text area object

返回:

the cursor position

bool lv_textarea_get_cursor_click_pos(lv_obj_t *obj)

Get whether the cursor click positioning is enabled or not.

参数:

obj -- pointer to a text area object

返回:

true: enable click positions; false: disable

bool lv_textarea_get_password_mode(const lv_obj_t *obj)

Get the password mode attribute

参数:

obj -- pointer to a text area object

返回:

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

参数:

obj -- pointer to a text area object

返回:

pointer to the replacement text

bool lv_textarea_get_one_line(const lv_obj_t *obj)

Get the one line configuration attribute

参数:

obj -- pointer to a text area object

返回:

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.

参数:

obj -- pointer to a text area object

返回:

list of accented characters.

uint32_t lv_textarea_get_max_length(lv_obj_t *obj)

Get max length of a Text Area.

参数:

obj -- pointer to a text area object

返回:

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.

参数:

obj -- pointer to a text area object

返回:

whether text is selected or not

bool lv_textarea_get_text_selection(lv_obj_t *obj)

Find whether selection mode is enabled.

参数:

obj -- pointer to a text area object

返回:

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 '*'

参数:

obj -- pointer to a text area object

返回:

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

参数:

obj -- pointer to a text area object

返回:

a the character or 0

void lv_textarea_clear_selection(lv_obj_t *obj)

Clear the selection on the text area.

参数:

obj -- pointer to a text area object

void lv_textarea_cursor_right(lv_obj_t *obj)

Move the cursor one character right

参数:

obj -- pointer to a text area object

void lv_textarea_cursor_left(lv_obj_t *obj)

Move the cursor one character left

参数:

obj -- pointer to a text area object

void lv_textarea_cursor_down(lv_obj_t *obj)

Move the cursor one line down

参数:

obj -- pointer to a text area object

void lv_textarea_cursor_up(lv_obj_t *obj)

Move the cursor one line up

参数:

obj -- pointer to a text area object

Variables

const lv_obj_class_t lv_textarea_class