Skip to main content
jimmii
Senior II
February 24, 2020
Solved

Periodic update of container content

  • February 24, 2020
  • 2 replies
  • 918 views

Hi,

I have a few views. On each view there is a container (date, time) which has to be updated periodically (every minute) with the new date/time. This container is the same on every view.

My idea is to go through the model with the modelListener. But this means that I have to implement the presenter method on every screen...

Is there a better way to do this? So that I have only one method in the container?

Thank for your help,

Cheers, /jimmii

This topic has been closed for replies.
Best answer by Alexandre RENOUX

Hi,

This has to be done the way you mentioned. TouchGFX framework is based on MVP (Model View Presenter) where you have one presenter per view. Therefore if you have functions in the model that needs to be called in the View, you have to go through implementing the function in its associated Presenter.

To avoid that you can have only one view instead. Therefore you will have only one Presenter that will implement the functions of the model. If many elements are shared among your views, it would be interesting to see if several views are relevant or if only updating the parts which are different is better.

/Alexandre

2 replies

Alexandre RENOUX
Alexandre RENOUXBest answer
Visitor II
February 25, 2020

Hi,

This has to be done the way you mentioned. TouchGFX framework is based on MVP (Model View Presenter) where you have one presenter per view. Therefore if you have functions in the model that needs to be called in the View, you have to go through implementing the function in its associated Presenter.

To avoid that you can have only one view instead. Therefore you will have only one Presenter that will implement the functions of the model. If many elements are shared among your views, it would be interesting to see if several views are relevant or if only updating the parts which are different is better.

/Alexandre

jimmii
jimmiiAuthor
Senior II
February 25, 2020

HI @Alexandre RENOUX​ 

Thanks. That's what I imagined.

/jimmii