lv_keyboard.h
API reference for lv_keyboard.h
Functions
lv_keyboard_set_textarea
Assign a text area to the keyboard. Pressed characters will be inserted there.
void lv_keyboard_set_textarea(lv_obj_t *obj, lv_obj_t *ta)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a keyboard object |
ta | lv_obj_t * | pointer to a text area object to write into |
lv_keyboard_set_mode
Set a new mode (e.g., text, number, special characters).
void lv_keyboard_set_mode(lv_obj_t *obj, lv_keyboard_mode_t mode)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a keyboard object |
mode | lv_keyboard_mode_t | the desired mode (see 'lv_keyboard_mode_t') |
lv_keyboard_set_popovers
Enable or disable popovers showing button titles on press.
void lv_keyboard_set_popovers(lv_obj_t *obj, bool en)| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a keyboard object |
en | bool | true to enable popovers; false to disable |
lv_keyboard_set_map
Set a custom button map for the keyboard.
void lv_keyboard_set_map(lv_obj_t *obj, lv_keyboard_mode_t mode, const char *const map[], const lv_buttonmatrix_ctrl_t ctrl_map[])| Name | Type | Description |
|---|---|---|
obj | lv_obj_t * | pointer to a keyboard object |
mode | lv_keyboard_mode_t | the mode to assign the new map to (see 'lv_keyboard_mode_t') |
map | const char *const | pointer to a string array describing the button map see 'lv_buttonmatrix_set_map()' for more details |
ctrl_map | const lv_buttonmatrix_ctrl_t | pointer to the control map. See 'lv_buttonmatrix_set_ctrl_map()' |
lv_keyboard_get_textarea
Get the text area currently assigned to the keyboard.
lv_obj_t * lv_keyboard_get_textarea(const lv_obj_t *obj)| Name | Type | Description |
|---|---|---|
obj | const lv_obj_t * | pointer to a keyboard object |
Returns: lv_obj_t * — pointer to the assigned text area object
lv_keyboard_get_mode
Get the current mode of the keyboard.
lv_keyboard_mode_t lv_keyboard_get_mode(const lv_obj_t *obj)| Name | Type | Description |
|---|---|---|
obj | const lv_obj_t * | pointer to a keyboard object |
Returns: lv_keyboard_mode_t — the current mode (see 'lv_keyboard_mode_t')
lv_keyboard_get_popovers
Check whether popovers are enabled on the keyboard.
bool lv_keyboard_get_popovers(const lv_obj_t *obj)| Name | Type | Description |
|---|---|---|
obj | const lv_obj_t * | pointer to a keyboard object |
Returns: bool — true if popovers are enabled; false otherwise
lv_keyboard_get_map_array
Get the current button map of the keyboard.
const char *const * lv_keyboard_get_map_array(const lv_obj_t *kb)| Name | Type | Description |
|---|---|---|
kb | const lv_obj_t * | pointer to a keyboard object |
Returns: const char *const * — pointer to the map array
lv_keyboard_get_selected_button
Get the index of the last selected button (pressed, released, focused, etc.). Useful in the event_cb to retrieve button text or properties.
uint32_t lv_keyboard_get_selected_button(const lv_obj_t *obj)| Name | Type | Description |
|---|---|---|
obj | const lv_obj_t * | pointer to a keyboard object |
Returns: uint32_t — index of the last interacted button returns LV_BUTTONMATRIX_BUTTON_NONE if not set
lv_keyboard_get_button_text
Get the text of a button by index.
const char * lv_keyboard_get_button_text(const lv_obj_t *obj, uint32_t btn_id)| Name | Type | Description |
|---|---|---|
obj | const lv_obj_t * | pointer to a keyboard object |
btn_id | uint32_t | index of the button (excluding newline characters) |
Returns: const char * — pointer to the text of the button
lv_keyboard_create
Create a Keyboard object
lv_obj_t * lv_keyboard_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 keyboard object
lv_keyboard_def_event_cb
Default keyboard event callback to handle button presses. Adds characters to the text area and switches map if needed. If a custom event_cb is used, this function can be called within it.
void lv_keyboard_def_event_cb(lv_event_t *e)| Name | Type | Description |
|---|---|---|
e | lv_event_t * | the triggering event |
Enums
lv_keyboard_mode_t
Current keyboard mode.
| Name |
|---|
LV_KEYBOARD_MODE_TEXT_LOWER |
LV_KEYBOARD_MODE_TEXT_UPPER |
LV_KEYBOARD_MODE_SPECIAL |
LV_KEYBOARD_MODE_NUMBER |
LV_KEYBOARD_MODE_USER_1 |
LV_KEYBOARD_MODE_USER_2 |
LV_KEYBOARD_MODE_USER_3 |
LV_KEYBOARD_MODE_USER_4 |
LV_KEYBOARD_MODE_TEXT_ARABIC |
Used by 2 functions
lv_keyboard_set_mode— parammodelv_keyboard_set_map— parammode
_lv_property_keyboard_id_t
| Name | Value |
|---|---|
LV_PROPERTY_KEYBOARD_TEXTAREA | (LV_PROPERTY_KEYBOARD_START + ((int) 0 )) | (( 8 ) << 28 ) |
LV_PROPERTY_KEYBOARD_MODE | (LV_PROPERTY_KEYBOARD_START + ((int) 1 )) | (( 1 ) << 28 ) |
LV_PROPERTY_KEYBOARD_POPOVERS | (LV_PROPERTY_KEYBOARD_START + ((int) 2 )) | (( 1 ) << 28 ) |
LV_PROPERTY_KEYBOARD_SELECTED_BUTTON | (LV_PROPERTY_KEYBOARD_START + ((int) 3 )) | (( 1 ) << 28 ) |
LV_PROPERTY_KEYBOARD_END |
Macros
LV_KEYBOARD_CTRL_BUTTON_FLAGS
#define LV_KEYBOARD_CTRL_BUTTON_FLAGS (LV_BUTTONMATRIX_CTRL_NO_REPEAT | LV_BUTTONMATRIX_CTRL_CLICK_TRIG | LV_BUTTONMATRIX_CTRL_CHECKED)Variables
lv_keyboard_class
const lv_obj_class_t lv_keyboard_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_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_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