lv_keyboard.h

Defines

LV_KEYBOARD_CTRL_BUTTON_FLAGS

Typedefs

typedef _lv_keyboard_mode_t lv_keyboard_mode_t

Enums

enum _lv_keyboard_mode_t

Current keyboard mode.

Values:

enumerator LV_KEYBOARD_MODE_TEXT_LOWER
enumerator LV_KEYBOARD_MODE_TEXT_UPPER
enumerator LV_KEYBOARD_MODE_SPECIAL
enumerator LV_KEYBOARD_MODE_NUMBER
enumerator LV_KEYBOARD_MODE_USER_1
enumerator LV_KEYBOARD_MODE_USER_2
enumerator LV_KEYBOARD_MODE_USER_3
enumerator LV_KEYBOARD_MODE_USER_4

Functions

lv_obj_t *lv_keyboard_create(lv_obj_t *parent)

Create a Keyboard object

Parameters:

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

Returns:

pointer to the created keyboard

void lv_keyboard_set_textarea(lv_obj_t *kb, lv_obj_t *ta)

Assign a Text Area to the Keyboard. The pressed characters will be put there.

Parameters:
  • kb -- pointer to a Keyboard object

  • ta -- pointer to a Text Area object to write there

void lv_keyboard_set_mode(lv_obj_t *kb, lv_keyboard_mode_t mode)

Set a new a mode (text or number map)

Parameters:
  • kb -- pointer to a Keyboard object

  • mode -- the mode from 'lv_keyboard_mode_t'

void lv_keyboard_set_popovers(lv_obj_t *kb, bool en)

Show the button title in a popover when pressed.

Parameters:
  • kb -- pointer to a Keyboard object

  • en -- whether "popovers" mode is enabled

void lv_keyboard_set_map(lv_obj_t *kb, lv_keyboard_mode_t mode, const char *map[], const lv_buttonmatrix_ctrl_t ctrl_map[])

Set a new map for the keyboard

Parameters:
  • kb -- pointer to a Keyboard object

  • mode -- keyboard map to alter 'lv_keyboard_mode_t'

  • map -- pointer to a string array to describe the map. See 'lv_buttonmatrix_set_map()' for more info.

  • ctrl_map -- See 'lv_buttonmatrix_set_ctrl_map()' for more info.

lv_obj_t *lv_keyboard_get_textarea(const lv_obj_t *kb)

Assign a Text Area to the Keyboard. The pressed characters will be put there.

Parameters:

kb -- pointer to a Keyboard object

Returns:

pointer to the assigned Text Area object

lv_keyboard_mode_t lv_keyboard_get_mode(const lv_obj_t *kb)

Set a new a mode (text or number map)

Parameters:

kb -- pointer to a Keyboard object

Returns:

the current mode from 'lv_keyboard_mode_t'

bool lv_buttonmatrix_get_popovers(const lv_obj_t *obj)

Tell whether "popovers" mode is enabled or not.

Parameters:

obj -- pointer to a Keyboard object

Returns:

true: "popovers" mode is enabled; false: disabled

static inline const char **lv_keyboard_get_map_array(const lv_obj_t *kb)

Get the current map of a keyboard

Parameters:

kb -- pointer to a keyboard object

Returns:

the current map

static inline uint32_t lv_keyboard_get_selected_button(const lv_obj_t *obj)

Get the index of the lastly "activated" button by the user (pressed, released, focused etc) Useful in the event_cb to get the text of the button, check if hidden etc.

Parameters:

obj -- pointer to button matrix object

Returns:

index of the last released button (LV_BUTTONMATRIX_BUTTON_NONE: if unset)

static inline const char *lv_keyboard_get_button_text(const lv_obj_t *obj, uint32_t btn_id)

Get the button's text

Parameters:
  • obj -- pointer to button matrix object

  • btn_id -- the index a button not counting new line characters.

Returns:

text of btn_index` button

void lv_keyboard_def_event_cb(lv_event_t *e)

Default keyboard event to add characters to the Text area and change the map. If a custom event_cb is added to the keyboard this function can be called from it to handle the button clicks

Parameters:

e -- the triggering event

Variables

const lv_obj_class_t lv_keyboard_class
struct lv_keyboard_t

Public Members

lv_buttonmatrix_t btnm
lv_obj_t *ta
lv_keyboard_mode_t mode
uint8_t popovers