Why does the numbers not save when I close and open the widget again?

Hello. I ran into a problem, where inside a widget it generates random numbers, but when ever I close the widget and then re-open it the numbers are back to zero. How can I save the numbers into the widget to that they don’t disappear.

If by closing it you mean remove from parent, then your numbers won’t save. You can just hide your widget.

Removing a widget from parent would not cause that. Dereferencing a widget would have the GC scoop it, though. Perhaps OP is creating a new widget every time they re-open it. Or they never reference in the first place. Or they run the randomisation code in Construct which would fire when re-parented.

@MangoPenguin2601 Show us how you do it.

1 Like

Sorry for the late anwser I was on a work trip. But I created the widget and then with a keyboard event i remove from parent. At the moment I am creating a phone so the widget that I want to keep “running / opened” is inside the phone (created into another widget).

Can you us how you add and remove it.

Yes, Here is how I did it. Both widgets are inside the main widget (phone) where i open all the other widgets (apps).


phoneproblem2