Skip to main content
AEpif.1
Associate
August 20, 2020
Question

how to make a back button between windows, instead of reset

  • August 20, 2020
  • 3 replies
  • 986 views

Tell me, can I make a button to return to the previous window with data saving?

This topic has been closed for replies.

3 replies

AEpif.1
AEpif.1Author
Associate
August 21, 2020

I need your help

Alexandre RENOUX
Visitor II
August 21, 2020

Hello,

Each screen has a different context and when you switch, all the information from the previous screen is lost.

To solve this, you have the model (Model.cpp) where you can save data in, and you will be able to retrieve it between Screens. You will have to go through the Presenters to set and get variables in the Model from your ScreenView.

Please have a look at the following articles to better understand how TouchGFX works :

https://support.touchgfx.com/docs/development/ui-development/software-architecture/model-view-presenter-design-pattern

https://support.touchgfx.com/docs/development/ui-development/software-architecture/screen-definition-and-mvp/

https://support.touchgfx.com/docs/development/ui-development/software-architecture/code-structure/

And the best part is that you can find a tutorial that explains how to switch between screens and save data in the Model ;) https://support.touchgfx.com/docs/tutorials/tutorial-03#step-2-saving-data

/Alexandre

Martin KJELDSEN
Principal III
September 1, 2020

Try looking through this forum to see if you can find a project i shared that keeps a stack of pointers to previous windows. This allows you to go "back", in the real sense of the word.