How to move between screens without deleting previous screen


I have two screens, a main screen that is very simple and a menu screen that is complex. The menu screen takes over a second to create on my hardware.

I would like to be able to switch between the screens via the load functions.

I would like to avoid deleting the menu_screen due to the time it takes to create it. However, if i do not delete it, I still get event handlers called for the inactive screen.

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


What LVGL version are you using?


What do you want to achieve?

I would like

What have you tried so far?

Code to reproduce

If I exit the menu_screen and try to load the main screen, I still get highlight events on the previous menu screen.

lv_scr_load_anim(menu_screen, LV_SCR_LOAD_ANIM_MOVE_LEFT, 1000, 0, false);
lv_scr_load_anim(main_screen, LV_SCR_LOAD_ANIM_MOVE_LEFT, 1000, 0, false);

Is there a way to switch screens without deleting the previous one and disable the event handlers on the inactive display?

My current approach is to lock out the menu screen events via a screen check, but this seems like a poor solution.

static void m_focus_handler(lv_event_t *e)
    lv_obj_t *curr_screen = lv_scr_act();
    if (curr_screen != menu_screen)