2019-03-01 08:18 AM
What's the difference between putting code in:
MyScreenViewBase::MyScreenViewBase(){}
vs
void MyScreenViewBase::setupScreen(){}
2019-03-04 02:19 PM
Hi @Du,
In a way there isn't, but conceptually, TouchGFX will tear down the "current" screen before calling "setupScreen" on the new screen being switched to. If you put all your initialization code in the constructor you would have constructed a new screen before the old one has been torn down which may or may not cause problems for you.
It's best practice to put screen specific initialization code in setupScreen(). You could still put other initialization code in the constructor.
Best regards,
Martin
2019-03-04 02:48 PM
Thanks again for the detailed explanation!