2021-05-21 04:20 PM
Thank you for helping.
I want to access common variables on several screens (View).
How do I pass a variable to View?
Will it be passed to the base class of View?
I want to make it a smart way without using global variables.
Thank you.
Solved! Go to Solution.
2021-05-23 09:59 AM
Smart is global, when you dont like global , then you create MODEL - PRESENTER - VIEW, but in real your variable master exist in MODEL as class variable, then is protected from access it on other threads . And for use in views need create setter and getter methods in every view and presenter...
2021-05-23 09:59 AM
Smart is global, when you dont like global , then you create MODEL - PRESENTER - VIEW, but in real your variable master exist in MODEL as class variable, then is protected from access it on other threads . And for use in views need create setter and getter methods in every view and presenter...
2021-05-23 11:13 PM
Hi MM ..1
I am always grateful for your help.
Sometimes the global is smarter, isn't it?
I will think about it.
2021-05-23 11:29 PM
In my opinion I would not use global variable here especially for complex application. While it might be convenient, but is poor in term of localization as everything in the code can access those variables. And it doesn't scale well as it would get messier when application is getting complex.
A more sound approach is to leverage existing TouchGFX Engine architecture Model-View-Presenter
All the data intent to persist over the View classes mus be in model class. But in order view to reflects Model data changes, it has to go through the Presenter class.