Text on wildcard sets to initial value after changing screeen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-11-02 6:00 AM
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.
Solved! Go to Solution.
- Labels:
-
TouchGFX
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-11-02 8:35 AM
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 ;)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-11-02 6:56 AM
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
ST Software Developer | TouchGFX
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-11-02 7:13 AM
Thank you. I'll develop that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-11-02 8:15 AM
I pass the values from the view to model, than back to the view... it keeps doing the turning to zero when changing screen
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-11-02 8:35 AM
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 ;)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-11-02 8:59 AM
That's what i was thinking.... thanks a lot it worked like a charm.
