(Moving) Option to disable scroll animation on when using SCROLL_ON_FOCUS flag


Moving post of my friend to here:

Is there any way to disable scroll animation when using SCROLL_ON_FOCUS flag? I am designing an interface to a low-powered MCU and we aren’t expecting any animation in the UI.
I am using a list and lv_group_focus_next/prev functions to alternate between the objects, so LV_OBJ_FLAG_SCROLL_ON_FOCUS is set. I didn’t found any way to disable animation when scrolling it, and would like to know if there is. Any suggestion of alternative methods to achieve what I want would also be welcomed.

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

Currently eclipse simulator

What have you tried so far?

I’ve found Scroll on focus without animation - Issue #2342 on GitHub but it didn’t help.

I found that the following code at line ~780 in file lv_obj.c:

    else if(code == LV_EVENT_FOCUSED) {
        if(lv_obj_has_flag(obj, LV_OBJ_FLAG_SCROLL_ON_FOCUS)) {
            lv_obj_scroll_to_view_recursive(obj, LV_ANIM_ON);

when changed to

           lv_obj_scroll_to_view_recursive(obj, LV_ANIM_OFF);

fixes my problem, but I do not want to change LVGL library code.

https://github.com/lvgl/lvgl/issues/2342 works for me.

I’ve tested it with lv_demo_widets():

void stop_scroll(lv_event_t * e)
    lv_anim_t * a = lv_event_get_scroll_anim(e);
    if(a) a->time = 0;

//In void lv_demo_widgets(void)
    lv_obj_t * t1 = lv_tabview_add_tab(tv, "Profile");
    lv_obj_add_event_cb(t1, stop_scroll, LV_EVENT_SCROLL_BEGIN, NULL); //ADD THIS

Anyway, it’s really too complicated now. I’ve added a note about in the ROADMAP: