How do you hide the keyboard?

What do you want to achieve?

  • When the user presses either the “return key” or the keyboard “checkmark” I want to set the keyboard’s ‘hidden’ flag.

What have you tried so far?

  • Created a function for the keyboard VALUE_CHANGED event. Tried to get the last pressed key with lv_indev_get_key(lv_indev_get_act()); but it just returns 0.
  • I noticed in the lv_event_code_t enum there is an event LV_EVENT_KEY but this is not provided in the SquareLine Studio UI.

Tried this handler added to the keyboard:

lv_obj_add_event_cb(ui_PopupKeyboard, KeyboardPopup_KeyPressed, LV_EVENT_VALUE_CHANGED, NULL);

But this handler produces no meaningful data reflecting the key pressed:

void KeyboardPopup_KeyPressed(lv_event_t *e)
    auto key = lv_indev_get_key(lv_indev_get_act());


In case it useful to anyone, I finally pieced together how to get the keyboard values:

void KeyboardPopup_KeyPressed(lv_event_t *e)
    auto key = lv_keyboard_get_selected_btn(ui_PopupKeyboard);
    auto button = lv_keyboard_get_btn_text(ui_PopupKeyboard, key);

    Serial.print(" | ");