444 views
in GUI Development by

Good Day to All.
I am working on an example.

i have done the necessary stuff for keypad and text area.
When i click on a button the enter password screen comes up.
i have also created an Unit with name Storage and an Class inside also called Storage.

inside this Storage object there is a variable Property called Password. by default it is set as string type and contains "1111".

on the enter password screen if 1111 is entered by keypad since property value is correct i can progress to a next screen.

 

in the next screen i have a place to enter new password with different core group objects. On this screen i want to change the value of Storage.Password.
After keypad operation on enter new Password screen i am struggling with updating the Storage.Password..

To summarize i need an initial password to enter the change password area, the correct password is required.

inside the new password screen the first initial value should be changed with my new password value and if i want to come back to new password screen now i should be using the new password.

 

Am i using the wrong chora object for starage area and value maybe? should my property be a variable? should i change something with onset property?

 

Thank you All.

 

 

2 Answers

0 votes
by
 
Best answer

Hello,

maybe you store the password in your Storage class and access it as autoobject - this is very convenient, because autoobjects can be accessed from everywhere in your project.

Please consider the livetime of autoobjects. Everytime, the autoobject is no more in use, the instance will be deleted by the Garbage Collector and the password is lost.

In order to prevent the Garbage Collector from freeing an autoobject, please add a variable to the root class, set the type according to your storage class (in your case Storage::Storage) and the default value to the instance (autoobject) of the class.

Does this help for your application?

Best regards,

Manfred.

by
Thanks for the answers

by root class do you mean inside Unit Application or inside class Application::Application where the canvas is?
by
yes, exactly - Application::Application is the instance that is created during startup and available the entire runtime of the GUI.
by

 

Should look like this correct?

by
Yes, the attribute Type should be set to Storage::Storage (as shown in your picture) and the Default value should be set to the autoobject.

Does it work?
by

Yes it works. The problem was i set up too many objects of Storage inside all the screens.

I just made a single autoobject of Storage under Unit Screens and directed all instances to that.

And after creating the variable StorageAgainstGarbage with type Storage::Storage and default Screens::Storage it works.

Next step will be device integration trying to save this variable on a MCU or EPROM or something so we can get last value when the device is shut down.

Thank You

You guys are very helpful i will probably be back with more questions on new topics :D

by
Great to hear that it works now!

Have a good day.
0 votes
by

Hello,

Am i using the wrong chora object for starage area and value maybe? should my property be a variable? should i change something with onset property?

Very difficult to say what is not working. Actually, I don't understand what you mean with the wrong chora object. Can you upload an example demonstrating your application?

Best regards

Paul Banach

Ask Embedded Wizard

Welcome to the question and answer site for Embedded Wizard users and UI developers.

Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!

Embedded Wizard Website | Privacy Policy | Imprint

...