Skip to main content
Tnguy.3
Associate II
November 10, 2021
Question

Difference between the two ways to switch screens?

  • November 10, 2021
  • 2 replies
  • 840 views

I have the following two codes that does the same thing,

application().switchScreen(new Screen3View());
static_cast<FrontendApplication*>(Application::getInstance())->gotoBrightnessScreenNoTransition();

But, the second one took more work since I need to set it up in the FrontendApplication.cpp, but I was wondering is there a difference between these two calls (beside one allows you to edit the transition)?

This topic has been closed for replies.

2 replies

Romain DIELEMAN
ST Employee
November 11, 2021

Hi,

There is none. The idea behind the first one is that it can be called a bit anywhere as long as you have the id of the screen you want to go to. The second one will mostly be used for if you want a screen transition animation which does not seem to be the case for you.

/Romain

Tnguy.3
Tnguy.3Author
Associate II
November 11, 2021

Hi Romain, thanks for your response. Please correct me if I'm wrong, but from one of my testing, when I use the first statement to switch to a screen that interacts with the model and presenter, I get a null exception error in my presenter trying to talk to the model BUT don't get it when I use the second statement to switch. So is it safe to say that using the first call does not pass the same model (assuming all views uses the same model) to new screen?

Or, was I just missing something?