Keyboard - does not write in the ta and does not perform events

during porting to library 6.0 if I assign events to the keyboard, it no longer writes to the tee.
If I press OK or ESC, it does not execute the event.

My code is:

	lv_obj_t * passwordtext = lv_ta_create(containerlevel, NULL);
	lv_obj_t *kb = lv_kb_create(containerlevel, NULL);
	lv_kb_set_ta(kb, passwordtext);
	lv_obj_set_event_cb(kb, keyboard_action);


static void keyboard_action ( lv_obj_t * obj, lv_event_t event )
	if ( event == LV_EVENT_APPLY )
	else if ( event == LV_EVENT_CANCEL )

any suggestions?

Thanks a lot :slight_smile:

You have to call the original event handler (lv_kb_def_event_cb) inside your new one. It’s like OOP inheritance.

You can refer to this example.



  • Called when a button is released
  • @param btn pointer to the released button
  • @param event the triggering event
  • @return LV_RES_OK because the object is not deleted in this function
    static void btn_event_cb(lv_obj_t * btn, lv_event_t event)
    if(event == LV_EVENT_RELEASED) {
    /Increase the button width/
    lv_coord_t width = lv_obj_get_width(btn);
    lv_obj_set_width(btn, width + 20);
1 Like

@hiVGL Please read the question carefully. This has nothing to do with button event handlers.

tanks @embeddedt…
I thought it needed the usual event manager … :sweat_smile:

Now he writes in ta but … events don’t work…
In my code I changed only

never enters in keyboard_action function…

Any suggestions?

@wcuter I think you misunderstood. You need to set your own custom event handler as normal, and inside that, call lv_kb_def_event_cb (passing it the object and event).

:sweat_smile:Sorry,I misunderstood…

@wcuter Just a sidenote, you can format the code blocks like this:
<your code>

I’ve updated your first comment.

@embeddedt thankyou very much
@kisvegabor thanks for the information


Im having a similar issue as you, but I still don’t understand the solution provided in this forum. Can I see how your new code looks?

Can you show a small ex of what you mean? I still don’t understand your solution to this problem.

lv_obj_t *kb = lv_kb_create(lv_scr_act(), NULL);
lv_obj_set_event_cb(kb, keyboard_ev_handler);
static void keyboard_ev_handler(lv_obj_t * obj, lv_event_t event)
    if ( event == LV_EVENT_APPLY )
        /* custom logic */
     /* default behavior */
    lv_kb_def_event_cb(obj, event);