2021-02-09 05:58 AM
Is there any way in TouchGFX to get any identification/handle/etc. of the current View?
I have one View that is accessible everywhere, and from that I want to return to the previous View.
How can store the previous View? Is a custom variable required for this + implementation in every single Presenter to store that custom variable?
2021-02-09 11:28 AM
You don't have to use the presenter. I had a similar problem a while ago.
At first, I created a global variable. Say "enum Previous_Screen". Set this variable before a jump to that common screen. Base on this variable value, return to the previous screen. But the screen transition function is a template. I have to use switch statements to handle screen transitions. The code became long-winded as more screens added.
In the end, I made this common view a customer container and add it where need it.
2021-02-10 01:10 AM
>I have to use switch statements to handle screen transitions. The code became long-winded as more screens added.
This is what I'm trying to avoid. Sorry didn't understand, did you achieve this without custom enum? I have 50 screens, such approach would be very laborious. There has to be a better way...
2021-02-10 06:22 AM
In my case, I made a custom container to replace that common screen and added it to the screens which need it.
Application class provides interfaces for manipulating screen contents. I didn't find anything there. I can only think of two things to track the previous screen, model, or a global variable. But both cases need a switch statement at the end.
Maybe TGFX employees know a better way.