Possible ways to do change screens


What is the preferred way to change screens. I have read screen load part from the documentation but i am in general not sure how this should happen. Lets say that with a button you want to change to settings page.
So what is the proper way just to load a screen?
what happens with the previous ? Should it be destroyed? Should it be hidden? and are you passing data between screens?
Is documentation there are no examples for this cases.

In any of my questions technically if there is any example to be share please do so the question is always if something is possible and how

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


What LVGL version are you using?


What do you want to achieve?

Program that normally changes between pages with shared data between them. Normal main page of program and settings/load/save setup page.

I would think the reason these questions are left open is because it would depend on the project itself.

To give an example, the project I’m currently looking at has loads of RAM but not a lot of processing time, so rather than load screens on-the-fly, I create all the screens at startup and essentially manage them by hiding as needed.

This uses more memory, but it a little easier on the CPU as it doesn’t need to do much memory allocation except at startup. This wouldn’t be appropriate if my constraint was in the other direction, such as if I had lots of CPU time but little RAM, in which case I would do less pre-allocation and more on-the-fly screen loading.

I understand it is logical but how can this point of view be connected to the esp32 cause cpu and ram is about controller?
or i suppose i have to keep tracking the memory in esp.
Could i have info about it in simulator ?
i know about cpu usage label that can be activated as the frames also but i do not know what is the cpu reference , does the simulator refer to esp32 or what other chip you could set or to laptops/desktop cpu (i suppose the second)?

I think if you’re using the SDL-based simulator then you’re just running natively on your development machine. I don’t know if there are any simulators for esp32.

If you’re not worried about constraints and just want to manage screens then first just try creating screens (lv_obj_t*) on top of other screens then destroy them and see what happens. I don’t know if there is a ‘preferred’ way to manage screens, but perhaps someone else here does.