I want the parent window and the child objects to receive events simultaneously


I want the parent window and the child object to receive events simultaneously
I create an object on screen,name is cont
then add event callback function,like lv_obj_add_event_cb,LV_EVENT_PRESSING and LV_EVENT_PRESSED
create an image obj img_obj1
then add a flag LV_OBJ_FLAG_CLICKABLE
then add event callback function,LV_EVENT_PRESSING
I click the image obj img_obj1,I can get the event by img_obj1_event_cb,But I didn t get the parent window callback event ,like scroll_event_cb.

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

linux t113

What LVGL version are you using?


What do you want to achieve?

When I click the img_obj,i can get pressing event from parent obj cont callback function and also img_obj1 callback function

    lv_obj_t *cont = lv_obj_create(lv_scr_act());
    lv_obj_add_event_cb(cont, scroll_event_cb, LV_EVENT_PRESSING, NULL);
    lv_obj_add_event_cb(cont, click_start_cb, LV_EVENT_PRESSED, NULL);

    img_obj1 = lv_img_create(cont);
    lv_img_set_src(img_obj1, menu->list[i].img_url);
    lv_obj_add_event_cb(img_obj1, img_obj1_event_cb, LV_EVENT_PRESSING, NULL);

Thank you for your help

Could event bubbling help?

I mean yes bubble send too to parrent, but you can send event from primary callback to next one.

lv_obj_send_event(obj, <EVENT_CODE>, &some_data)

Thank you very much, this this works properly by Bubble