cancel
Showing results for 
Search instead for 
Did you mean: 

Text on wildcard sets to initial value after changing screeen

Riccardo Franceschetto
Associate III

Hello,

I'm implementing an application with touchgfx, i use wildcards with buffer, and two buttons that increse or decrease the value in the wildcard.

When i go back to previous screen, and re enter the screen with wildcards, those resets to initial value "0" that i set in touchgfx designer, then when i press the buttons to increase or decrease the value, this updates correctly to the value where it last was set, but only after changing it.

How do i keep this values shown after i change and re enter the screen, without them changing to zero?

Thanks a lot.

1 ACCEPTED SOLUTION

Accepted Solutions

On enter any screen is all objects reset to designer setup and your user part function is called before show screen (render)

Your code must restore from stored values viewed objects.

void Screen1View::setupScreen()
{
    Screen1ViewBase::setupScreen();
 
... your init code

 and ofcourse your code after base call, not before ;)

View solution in original post

5 REPLIES 5
Yoann KLEIN
ST Employee

Hello,

The best way to insure that the values will remain the same between the different screens is to store them in the Model, which is a common resource for every screen. You could update your values in the Model after clicking on the button in the UI, and on the same hand send the value to the UI from the Model when needed, through the Presenter.

I provided an example of that practice on a post, some months ago. The application was dealing with a Clock, but the principle remains the same, so you should succeed pretty easily.

To fully understand how it works, I encourage you to read some documentation articles, especially the one dealing with the Model-View-Presenter pattern.

Let me know if you have other questions.

/Yoann

Yoann KLEIN
ST Software Developer | TouchGFX

Thank you. I'll develop that.

I pass the values from the view to model, than back to the view... it keeps doing the turning to zero when changing screen

On enter any screen is all objects reset to designer setup and your user part function is called before show screen (render)

Your code must restore from stored values viewed objects.

void Screen1View::setupScreen()
{
    Screen1ViewBase::setupScreen();
 
... your init code

 and ofcourse your code after base call, not before ;)

That's what i was thinking.... thanks a lot it worked like a charm.