Page scrollbar appears even if scrollbar mode is set to LV_SCRLBAR_MODE_DRAG


Hello everyone,
in a project i’m working on i use a page widget to display a list of custom widgets and i set the scrollbar mode to LV_SCRLBAR_MODE_DRAG because that is exactly what i want. When I fill the page with enough widgets to enable scrolling the scrollbar is displayed anyway.

I have this issue in both the simulator and the actual hardware.

By the way, i really appreciated LVGL, great job!

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

I’m using a Raspberry Pi 3B+ running a custom linux system created with Buildroot, the compiler is gcc v6.3.0 (but also g++ since my project is written in C++). I’m using LVGL v7.7.2.

What do you experience?

Displaying widgets in the page works fine but the problem is that, as soon as i populate the page with enough widgets to need scrolling, the vertical scrollbar is displayed even if nobody dragged the page.
Then, the first time i drag the page up or down, it starts behaving as i expected (as soon as i stop dragging the scrollbar disappears).

Am i missing something? Is this how it is supposed to work?

What do you expect?

The documentation says

LV_SCRLBAR_MODE_DRAG Show scroll bars when the page is being dragged

so i expected the scrollbar to appear only when dragged, not when it’s populated.

Code to reproduce

This is how the page object is created (_root is the container in which the _page is located):

_page = lv_page_create(_root, nullptr);
lv_obj_add_style(_page, LV_PAGE_PART_BG, &Styles::listBg);
lv_obj_add_style(_page, LV_PAGE_PART_SCROLLABLE, &Styles::listScrollable);
lv_obj_add_style(_page, LV_PAGE_PART_SCROLLBAR, &Styles::listScrollbar);
lv_obj_set_size(_page, w, h);
lv_page_set_scrlbar_mode(_page, LV_SCROLLBAR_MODE_DRAG);
lv_page_set_scrl_layout(_page, LV_LAYOUT_COLUMN_MID);
lv_page_set_anim_time(_page, 100);

Screenshot and/or video

Without touching the page the green scrollbar appears when the enough widgets are placed into the page:


It was really a bug. I’ve just fixed it in the master branch.

Ok, thanks!