cancel
Showing results for 
Search instead for 
Did you mean: 

Various screens vs various containers

GMeur
Senior

Hello,

If various elements of the GUI I'm working on are going to be shared amongst most of the screens (footer, header, status bar,…), do you think it's a good idea to use a single TouchGFX screen and to change only the central content by means of containers?

Therefore, I'd have to create various containers, say container_screen1, container_screen2,... and swap from one to another like this:

container_centralZone.add(container_screen1);

/* after an action*/

container_centralZone.remove(container_screen1);

container_centralZone.add(container_screen2);

However, as we want to use as little heap as possible in the project I'm currently working on, the problem of this solution is that all containers must be created statically upon the creation of the TouchGFX main screen…

None of the two solutions (screens vs containers) are perfect, but I'm currently leaning towards using the containers one and I'd like to hear your opinion on this to make a sound decision.

Thanks in advance

1 ACCEPTED SOLUTION

Accepted Solutions
Alexandre RENOUX
Principal

Going for screens make the application easier to understand and develop. However, if you need to save some values from one screen to the other, then you have to save these values in the model. On the other hand, using a unique screen will make sure that your variables are always accessible on your entire application without using the Model.

As you mentioned, the more you have in one screen, the bigger the heap will be. So make sure you have enough RAM.

On a CPU point of view, having only one screen and several containers to update only partly the screen will perform better because you do not need to render the whole screen. Your application will then be smoother.

Depending on the RAM at your disposal, you can use one or the other.

View solution in original post

1 REPLY 1
Alexandre RENOUX
Principal

Going for screens make the application easier to understand and develop. However, if you need to save some values from one screen to the other, then you have to save these values in the model. On the other hand, using a unique screen will make sure that your variables are always accessible on your entire application without using the Model.

As you mentioned, the more you have in one screen, the bigger the heap will be. So make sure you have enough RAM.

On a CPU point of view, having only one screen and several containers to update only partly the screen will perform better because you do not need to render the whole screen. Your application will then be smoother.

Depending on the RAM at your disposal, you can use one or the other.