LV_EVENT_SCROLL_BEGIN will never fire with LVGL V8.3.1 on my board


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

Allwinner D1s CPU

What LVGL version are you using?


What do you want to achieve?

I am working on port lvgl 8.3.1 to this processor. Touch event like pressing are good. But the LV_EVENT_SCROLL_BEGIN will never fire. Really need help here, thanks~~

What have you tried so far?

(1) Checked indev point events with coordinates & state, all points are fluent when finger touch moves.
(2) The switch & slider demos works fine. But The tabview demo can not work with scrolling and even can not show tab content by clicking another tab button, it always show tab1 content .
(3) Tried to capture lv_event when scrolling, I can captured the gesture directions event correctly, but LV_EVENT_SCROLL_BEGIN will never fires when I tried to scroll the screen.

Code to reproduce

void lv_example_tabview_1(void)
/Create a Tab view object/
lv_obj_t * tabview;
tabview = lv_tabview_create(lv_scr_act(), LV_DIR_TOP, 50);

/*Add 3 tabs (the tabs are page (lv_page) and can be scrolled*/
lv_obj_t * tab1 = lv_tabview_add_tab(tabview, "Tab 1");
lv_obj_t * tab2 = lv_tabview_add_tab(tabview, "Tab 2");
lv_obj_t * tab3 = lv_tabview_add_tab(tabview, "Tab 3");

/*Add content to the tabs*/
lv_obj_t * label = lv_label_create(tab1);
lv_label_set_text(label, "This the first tab\n\n"
                  "If the content\n"
                  "of a tab\n"
                  "becomes too\n"
                  "than the\n"
                  "then it\n"
                  "Can you see it?");

label = lv_label_create(tab2);
lv_label_set_text(label, "Second tab");

label = lv_label_create(tab3);
lv_label_set_text(label, "Third tab");

lv_obj_scroll_to_view_recursive(label, LV_ANIM_ON);


Screenshot and/or video (3.6 MB)

I saw this:
fix(scroll): do not fire scroll begin/end event on every scroll step · lvgl/lvgl@25ce6e3 (

But I have checked the v8.3.1 code which already fixed this, any idea or anything I can try?

when you check lv_tabveiw.c file, you can find lv_obj_scroll_to_x() api to support scroll animation.
you can set LV_ANIM_ON or LV_ANIM_OFF.
and LV_EVENT_SCROLL_BEGIN will be fired when you call this api (lv_obj_scroll_to_x) with LV_ANIM_ON.

let me check the code in lv_tabview_set_act() function.

if(lv_obj_get_style_base_dir(obj, LV_PART_MAIN) != LV_BASE_DIR_RTL) {
    lv_obj_scroll_to_x(cont, id * (gap + w), anim_en);
else {
    int32_t id_rtl = -(int32_t)id;
    lv_obj_scroll_to_x(cont, (gap + w) * id_rtl, anim_en);

lv_obj_scroll_to_x() api was called with cont object…

as you know, cont object is a second child of tabview object.
so, cont object will be received LV_EVENT_SCROLL_BEGIN event.

lv_obj_t * lv_tabview_get_content(lv_obj_t * tv)
return lv_obj_get_child(tv, 1);

if you want to receive this event in your source code.
you should add callback event like below;

cf) lv_obj_add_event_cb(lv_obj_get_child(tabview, 1), event_cb, LV_EVENT_SCROLL_BEGIN, NULL);

and then, if you click the tab button, you can see that calling event_cb()