cancel
Showing results for 
Search instead for 
Did you mean: 

mvp concept at custom container level

shark
Senior

I have designed my small component as a custom wedget that will be embeded in many screens. This component need do some data interations with background system.

As document suggested, I would like to use MVP architecture to implement data exchanges. But I find that the presenter is at screen level, not the wedget level. So I have to re-transfer data through screen/view to it's internal componet? And I have to do it in every screen that used the component.

Can I do data exchanges at component level with MVP concept?

4 REPLIES 4
Michael K
Senior III

"Because TouchGFX is implemented in C++ you have the option of taking advantage of object-oriented paradigms in your screens. If for instance all your screens need to display a status bar at the top, showing current time, battery level, et cetera you can create a base view class containing the status bar only and have all your views deriving from this class, so you get the status bar functionality automatically."

Source: https://touchgfx.zendesk.com/hc/en-us/articles/205717801-The-Screen-Concept-and-Model-View-Presenter

shark
Senior

Thank for your reply and I understand your method, it applies on small project only.

After I checked along the current data exchange path, I implemented another way, maybe helpful for someone else, that is.

For any comonent that need data interaction, it register a callback function onto the model when created and un-register it before destroy, model will call all the callbacks at tick event.

So every component can be more indepedent each other.

Is there an updated link to this ressource?