How to re-initialize UI or reset the state of all widgets?

Hello @kisvegabor,
I want to reset the state of all widgets of all screens to the default state set by Squareline Studio.
Just an initial state like after we call ui_init().

Keshav Aggarwal


I would like to understand the bigger picture. What is the use case in which you need such a feature?

As per application, after the task is completed by a user, another user will be accessing the same GUI from beginning.
So, before switching to screen1 or main screen, I need to reset the state of each widget on all screens that were changed by the previous user.

I see now, thanks.

Using the new Temporary screen feature could be used here, as it keeps only the current screen alive.

I checked this out and found this-
“When using this feature, you need to be careful not to enable it on screens where something is happening even when it’s not visible.”

But in my case, widgets might be updating in background for inactive screens. What do you suggest now?

Can we have something like ui_deinit() or ui_Screen1_screen_deinit() so that I can do ui_init() or ui_Screen1_screen_init() again?

I see.

You can create a custom ui_deinit() function in which the following needs to be done:

  • lv_anim_del(NULL, NULL): delete all animations
  • lv_obj_del(ui_screen_...) delete all screens one by one

After that you can call ui_init() again.

Please let me know how it works.

It’s causing Hardfault. Find the attached callstack.


void Display_ResetContent()
	lv_anim_del(NULL, NULL);



For this kind of application, I would suggest you designing a screen that contains a kind of “Accessing Entry”. UI operation of LVGL is actually the modification of some variables.

When user click “ENTER” (for instance) from the “Accessing Entry” screen, and do some modifications of the UI, after that, the user should click “QUIT”, and when the “CLICKED” event happens, you should reset all values that the user changed and set relevant UI objects to their default state. In this way, when a new user click “ENTER” from the “Accesing Entry” screen, everything is new.

Thanks for suggestion. But in my application, it won’t be feasible to manually reset each and every widget as there are many widgets to do so.

Hello @kisvegabor. You have any update here?

Keshav Aggarwal

Can you send an images about code in ui.c around line 413? I’d like to see exacltly where is fails.