cancel
Showing results for 
Search instead for 
Did you mean: 

Return to "previous" view & keep track of views

XD
Associate III

Hello everyone!

The question is simple, i want to be able to "return" to the previous view when entering a sub-menu (view).
There are many ways to do this, like manually assigning a label/identifier to each view.

Pushing the label anto a stacked stored in the Model when entering a sub menu, then pop:ing the label and checking if it corresponds to a "sub-menu entry" when leaving the view.

Question 1:
Is there some built in mechanism to individually identify each view?
I would like to avoid manually adding labels to the views like enums etc.

Question 2:
Is there a built in system for handling this?
I haven't been able to find it in the documentation and would obviously prefer to use a excising built in solution than writing one myself.

 

Example below:

I want the cursor/arrow to return "Sub menu 1:A" when returning from sub menu "1:A"

 

ExampleMenu.png

 

 

3 REPLIES 3
Osman SOYKURT
ST Employee

Hello @XD ,

TouchGFX does not have a built-in feature to handle this; however the solution you described using the model and assigning each menus to an enum value would also be what I would go for if I wanted to implement this. Remember that each screens of your application are independent, and they do not share any informations directly, this can be done through the model :
"The Views and Presenters are deallocated when switching screen, so they cannot be used to store information which should be kept across screen transitions. Use the Model for this instead.".

Osman SOYKURT
ST Software Developer | TouchGFX

Hi @Osman SOYKURT 

Thanks for the reply.

Is there no built in way to identify the views? Something like a view number assigned by the framework or "pointer table" etc. If not are there any plans to implement something like this?

I have a TouchGFX project with a few dozen views, it is a real hassle and prone to mistakes when manually assigning labels to all the screens.

I hear the challenges you're having, thank you for your feedback. As far as I know there is no plan to implement this feature, but I can bring the idea on the next meeting I'll have with the team. I'll let you know if we'll consider to do it or not.

Osman SOYKURT
ST Software Developer | TouchGFX