cancel
Showing results for 
Search instead for 
Did you mean: 

Using multiple views vs. view with containers

CPaye.1
Associate III

I am using TGX v4.16 on F4 hardware.

In the first version of my application, to give all of my views the same basic look, I created a template view to be inherited by the view classes. The template created a "header" and "footer" on each view. A user used controls in the footer that to make the view change the custom container shown in the middle of the view. So basically the content changed and it looked like a new screen but from the code's perspective it was all the same view.

0693W00000GXIuvQAH.pngI now need to make a second version of the application. This will be a significant update so I am free to reevaluate my design.

My question is this: from an architecture/maintenance approach, is it better to stick with the existing design or replace the custom containers with view classes? (I would still keep the template class that all views inherit.) So for example if I now had three view with four containers each, if I went with making everything view classes, I would end up with 12 different view classes.

Given the scope of the content I will have to present, the one view to many containers feels like the right approach, but I'd like to get a gut check before I dive too deep.

Thanks.

2 REPLIES 2
DSwea.1
Associate III

I'm considering some of the same issues (I suspect the situation you describe is somewhat common) in my current project, and I wonder how your approach interacts with TouchGFX's stated policy of having only one active "screen/view" in memory, and pre-allocating memory to accommodate the largest screen in the project.

In your case, there is only one screen. So, it would seem that the allocation would be proportional to the number of custom containers used in the single screen. It may not be quite so simple, depending on the sophistication of TouchGFX's ability to analyze the actual memory required at a single moment (e.g. there are multiple components defined for the screen, but are they all maintained in memory, or only the one currently on display?). But, if the allocation is based on the total number of objects defined for the screen/view, it would seem that using multiple screens/views, each with a single middle container would require less memory. Note that you could still use your header and footer custom classes on the individual screens.

I'm not knowledgeable enough of the internal workings of TouchGFX to answer this. But a few comparison tests might provide the necessary insights. I'd welcome comments from more expert users.

CPaye.1
Associate III

Good call about the screen allocation - I had not thought about that aspect of the design. In each of my "parent" views, they instantiate their child custom containers at compile time. Presumably this is enough for the TGX memory magic to work. One benefit of this approach is that I don't need to manage a bunch of presenters so the overall program size is reduced.

I agree that this seems like it would be a very common use case for designers. It would be great if this could be addressed in the TGX online documentation at some point.