How to filter events code using |(or) to receive several events but not all events


how to filter unwanted EVENTs callback to reduce callback fucntion calling?

I want to input some numbers to text area by key board, however, I found that kb_event_cb and ta_event_cb functions called many times during inputing and most of them is not what I care about.

this is part of my codes:
ui->screen_standbymain_keyboad_press_in = lv_keyboard_create(ui->screen_standbymain);
lv_obj_add_event_cb(ui->screen_standbymain_keyboad_press_in, kb_event_cb, LV_EVENT_ALL, NULL);
lv_obj_add_flag(ui->screen_standbymain_keyboad_press_in, LV_OBJ_FLAG_HIDDEN);

lv_keyboard_set_mode(ui->screen_standbymain_keyboad_press_in, LV_KEYBOARD_MODE_NUMBER);
lv_keyboard_set_textarea(ui->screen_standbymain_keyboad_press_in, ui->screen_standbymain_press_input);
lv_obj_add_event_cb(ui->screen_standbymain_press_input, ta_event_cb, LV_EVENT_ALL, ui->screen_standbymain_keyboad_press_in);

///////////////////////this callback function of key board//////
static void kb_event_cb(lv_event_t *e)
lv_event_code_t code = lv_event_get_code(e);
lv_obj_t *kb = lv_event_get_target(e);
printf("****key board event code: %d\n",code);
if(code == LV_EVENT_READY || code == LV_EVENT_CANCEL){
lv_obj_add_flag(kb, LV_OBJ_FLAG_HIDDEN);
//I want get the text after click OK button.
if (code == LV_EVENT_READY)
static char ab[5] = “”;
bab = lv_textarea_get_text(ui->screen_standbymain_press_input);//error: because ui is undefined…
////////this callback function of textarea//////
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(e);
lv_obj_t *kb = lv_event_get_user_data(e);
printf("+++text area event code++++: %d\n", code);
if (code == LV_EVENT_FOCUSED)
	lv_keyboard_set_textarea(kb, ta);
	lv_obj_clear_flag(kb, LV_OBJ_FLAG_HIDDEN);
	lv_keyboard_set_textarea(kb, NULL);
	lv_obj_add_flag(kb, LV_OBJ_FLAG_HIDDEN);


What MCU/Processor/Board and compiler are you using?

STM32,And PC simulator

What LVGL version are you using?


What do you want to achieve?

filter unwanted events.

What have you tried so far?

try change “LV_EVENT_ALL” to event code what I care like “LV_EVENT_READY | LV_EVENT_CANCEL” or " LV_EVENT_FOCUSED|LV_EVENT_DEFOCUSED"