Built In Screen Unload Function

What do you want to achieve?

Built in function that can be called in the events area that will unload (lv_obj_del or maybe lv_obj_clean) all widgets on that screen, so that possibly you can call the “unload event”, and then the screen change following that so will load the selected screen just like normal. If im thinking right (i may not!!), maybe this can free up memory when screens are changed for those that do not need to update widgets on other screens.

Do you see alternative options and workaround to achieve it?

Manually calling an exterior init and delete function for widgets, but would have to be hand done.

Mention some use cases

In this fashion I’m thinking that it would allow for the creation of more screens, etc. and thus make it possible to free up memory by “unloading a screen” prior to loading the next screen rather than having all assets loaded in memory in the mcu… or maybe just enable a checkbox in the project options that make it so that when you change a screen, it unloads the objects in the current screen, maybe call it “memory optimized mode”.

1 Like

We have added exactly this in the next release. You can mark the screen as “Temporary” by a checkbox. Temporary screens are not created by default, but only when you load them. If you leave a temprary screen, it will be deleted automatically.

3 Likes

Brilliant!
Looking forward to the next release!
I spent a lot of time on the current design and this should make it possible to continue in that direction!
Thanks again for such a great tool!

2 Likes

So happy to see this coming in the next release.

When you mention that the screens will be “deleted” can they be called to load again from another button on a loaded screen once they have been “deleted” or do they just get re-initialized once again?

If you load a screen with SLS’s Screen Change event, it will create the screen automatically if it was deleted.

Excellent, thanks for the clarification!