What do you want to achieve?
What have you tried so far?
I’m implementing the virtual keyboard widget on my application, I took the basic example Keyboard (lv_keyboard) - LVGL 9.4 documentation.
If I define the keyboard and the text area as children of “parent” after the first digit it freezes and does not let me proceed, while if they are children of the active screen it works correctly.
How can i solve it?
Code to reproduce
static void ta_event_cb(lv_event_t * e)
{
lv_event_code_t code = lv_event_get_code(e);
lv_obj_t * ta = lv_event_get_target_obj(e);
lv_obj_t * kb = (lv_obj_t *)lv_event_get_user_data(e);
if(code == LV_EVENT_FOCUSED)
{
lv_keyboard_set_textarea(kb, ta);
lv_obj_remove_flag(kb, LV_OBJ_FLAG_HIDDEN);
}
if(code == LV_EVENT_DEFOCUSED)
{
lv_keyboard_set_textarea(kb, NULL);
lv_obj_add_flag(kb, LV_OBJ_FLAG_HIDDEN);
}
}
void SettingPage(lv_obj_t * parent)
{
/*Create a keyboard to use it with an of the text areas*/
lv_obj_t * kb = lv_keyboard_create(parent);
/*Create a text area. The keyboard will write here*/
lv_obj_t * ta1;
ta1 = lv_textarea_create(parent);
lv_obj_align(ta1, LV_ALIGN_TOP_LEFT, 10, 10);
lv_obj_add_event_cb(ta1, ta_event_cb, LV_EVENT_ALL, kb);
lv_textarea_set_placeholder_text(ta1, "Hello");
lv_obj_set_size(ta1, 140, 80);
lv_keyboard_set_textarea(kb, ta1);
}
Screenshot and/or video
Environment
- MCU/MPU/Board: STM32F746BGT
- LVGL version: 9.3.0