2023-06-19 03:52 AM
Hi,
I want to switch off the toggle button itself after a specific interval, let's say 60 sec.
Currently it works fine in View.cpp using handleTickEvent but as soon as I navigate to different screen, it doesn't update.
Is it possible to run this counter in the backend?
I'm using STM32F429.
Thanks
Solved! Go to Solution.
2023-06-21 02:41 AM
Hello
Here is simple example how timing can be done in model- class and also how to communicate from view to presenter and presenter to model. Just open the MVP_toggleBtnEx.touchgfx file from TouchGFX folder with TGFX desingner 4.21.4 or later and run the simulator. Because of new 5 MB attachment size limit, project is simplified to minimum.
Please note that presenter of every screen doesn't need to implement 'switchTimeElapsed' function since its defined virtual in base class of presenter (modelListener).
2023-06-20 07:04 AM
Hello
What else must happen when toggle switch is swiched off after some time period ?
You probably could use model::tick- function to implement this kind of functionality handled by model- class.
Just set some functions to presenter- class to tell model-class to start/stop counter and then add the functionatily also to model- class.
2023-06-21 12:05 AM
Hi,
Thanks for responding. Basically toggle button is switching on and off the light. I want once toggle is on, it switch off itself after 60sec. It works fine as long as I stay in that same screen but as soon as I navigate to different screen it doesn't update.
2023-06-21 02:41 AM
Hello
Here is simple example how timing can be done in model- class and also how to communicate from view to presenter and presenter to model. Just open the MVP_toggleBtnEx.touchgfx file from TouchGFX folder with TGFX desingner 4.21.4 or later and run the simulator. Because of new 5 MB attachment size limit, project is simplified to minimum.
Please note that presenter of every screen doesn't need to implement 'switchTimeElapsed' function since its defined virtual in base class of presenter (modelListener).