Changing screen programatically
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-02-13 9:51 AM
Hi I was wondering what the best method is to change screens programatically. I saw
application().gotoXScreenNoTransition()
and also
static_cast<FrontendApplication*>(Application::getInstance())->gotoXScreenNoTransition();
Is there any difference in efficiency for the program?
Solved! Go to Solution.
- Labels:
-
TouchGFX
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-02-17 4:35 AM
Hello @Priyank ,
The 2 methods are similar in efficiency (technically slightly more efficient to go for application().gotoXScreenNoTransition() but this is very negligeable).
The difference is that the method application().gotoXScreenNoTransition() is simpler, more readable, and type-safe if application() returns the correct type directly.
On the other hand, static_cast<FrontendApplication*>(Application::getInstance())->gotoXScreenNoTransition() allows casting to a more specific type, which is useful if Application::getInstance() returns a base class pointer and you need to access derived class methods.
Regards,
Software engineer at ST (TouchGFX)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-02-17 4:35 AM
Hello @Priyank ,
The 2 methods are similar in efficiency (technically slightly more efficient to go for application().gotoXScreenNoTransition() but this is very negligeable).
The difference is that the method application().gotoXScreenNoTransition() is simpler, more readable, and type-safe if application() returns the correct type directly.
On the other hand, static_cast<FrontendApplication*>(Application::getInstance())->gotoXScreenNoTransition() allows casting to a more specific type, which is useful if Application::getInstance() returns a base class pointer and you need to access derived class methods.
Regards,
Software engineer at ST (TouchGFX)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-02-24 2:00 AM
Hello @Priyank ,
Did you found the information you needed?
Regards,
Software engineer at ST (TouchGFX)
