2023-08-03 10:47 AM
Hi all,
I want to change from firstScreen to secondScreen if there is some text displayed on the firstScreen. I found an old post (here) where the accepted answer says it is difficult right now and working on a better way ... that post is from 2019 though. Is there a newer/simpler way to change screen from code?
Thanks
2023-08-03 11:24 AM - edited 2023-08-03 11:30 AM
Hello
Not really. I would prefer method that just create all needed screen changes as interactions to some of your screen like:
It doesn't even require any trigger. You can also define two different transitions for different directions to your screens, if needed,
TGFX will then generate needed functions for changing screens to frontend- base class (FrontendApplicationBase.cpp) and they can be called from any screen like:
application().gotoScreen2ScreenSlideTransitionEast();
Or from model-class for example like:
static_cast<FrontendApplication*>(Application::getInstance())->gotoScreen2ScreenSlideTransitionEast();
(add '#include <gui/common/FrontendApplication.hpp>' to model.cpp)
Other way is use actions like in your linked answer.
BR J.T
PS. Note that you can also set screen change for function of some button by setting trigger 'button is clicked'
2023-08-05 02:26 PM
Hi ...
For screen changing in sequence or jumping to any screen , Interaction feature is used.
I use 2 Interactions for each screen (accept first and last screens) as NEXT_SCREEN & PREVIOUS_SCREEN
For NEXT_SCREEN Interaction , below is example
For PREVIOUS_SCREEN Interaction , below is example
Tip: To keep the codes uniforms for each screen transition , name the screens like ,
Screen_01 , Screen_02 , Screen_03 etc
for each ScreenViewBase.cpp , the transition will be added like below
Now , need to code the keys read feature any one of followings
1. Simple GPIO keys without interrupt
2. SPI IO Expander Keys with interrupt
3. I2C IO Expander Keys with interrupt
I will show you 1 example > Simple GPIO keys without interrupt
keys.hpp
keys.cpp
Following is one of my ongoing TouchGFX development with Samsung Tab3 10.1" , 1280x800 TFT
In this experiment , I have 10 different screens .
attached are the files for first type : Simple GPIO keys without interrupt
Let me know , if more info required.
BR
I.N