[Howto] How to get LV_EVENT_GESTURE on lv_page?


How to get LV_EVENT_GESTURE for lv_page?

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


What do you want to achieve?

I would like the lv_page can receive LV_EVENT_GESTURE.

What have you tried so far?

I tried the following code for testing event_cb for lv_page.
However the page can’t receive LV_EVENT_GESTURE in the page’s event_cb.

Code to reproduce

void page_event_cb(lv_obj_t* page, lv_event_t event){
  if( event == LV_EVENT_GESTURE){

void page_create() {
  page = lv_page_create(lv_scr_act(), NULL);
  lv_obj_set_size(page, 400,300);
  lv_obj_align(page, NULL, LV_ALIGN_CENTER,0,0);
  lv_obj_set_gesture_parent(page, false);
  lv_obj_set_event_cb(page, page_event_cb);


Screenshot and/or video

I think it might be because pages are draggable, and gestures are mutually exclusive with dragging. Does it work on a plain lv_obj?

Yes, it works on a plain lv_obj and other lvgl’s widgets
expection lv_page can’t receive.

Yu can locally fi it by commenting out this line:

1 Like

I will try , thank you very mush. Master!

1 Like