2019-03-28 06:13 AM
Hello all,
I am trying to switch the screen throuch code in touchgfx.
If I use SwitchScreen, how shall I state the argument (screen* newScreen)?
If, for example I want to switch to Screen7.
Shall I call the function with SwitchScreen(scr7)?
where scr7 is declared as follows:
ScreenView7 scr7;
Solved! Go to Solution.
2020-02-21 01:49 AM
I'm wondering about the same thing.
The TouchGFX team promised to come back with some video demos in the near future (as in the end of this month or so).
Please share if you found a solution for this problem.
2020-02-21 05:39 AM
I've got the project for this all lined up :) Does exactly what you're describing. Will do a video on it asap.
* CubeMX: Configure GPIOS according to schematics
* TouchGFX HAL: Implement a function that can hand over hardware button press to TouchGFX application
* TouchGFX Designer: Map the value from HAL to Designer territory to be able to use the press as a trigger in an interaction.
/Martin
2020-02-21 05:40 AM
Second screen has no background = you're seeing garbage memory on target, and some weird state in the simulator.
2020-04-08 07:03 PM
Martin,
Have you released the video yet? If so please supply a link.
Thanks
Frank
2020-04-09 01:44 AM
Hi @FDeLu.1,
I already shot the video, yes, but i haven't edited it yet. Has to follow company protocols, etc. I did it as a one-take to save time and i'm just considering if i'm happy with releasing it.
/Martin
2020-04-10 06:49 AM
OK please post the link once released.
Also is it OK to call another screen from the view or should it be done from the presenter or model? In a splash screen tick handler we have a timing loop that keeps the screen active for a couple seconds then calls "static_cast<FrontendApplication*>(Application::getInstance())_>gotoHomeScreenNoTransition();" from the handler. Is that the correct place to call for the screen change or should it be done elsewhere?
Thanks,
Frank
2020-05-08 02:24 PM
@FDeLu.1
Where did you end up doing calling your screen transitions? I am attempting doing it in a message handler in FrontendApplication.cpp.
@Martin KJELDSEN I am currently looking at implementing a message queue (from main.c) to send the TouchGFX task messages. These messages will be different dependent on the current screen being viewed. I was thinking putting this message handler in a common area such as FrontendApplication.cpp. Or would the model class be best place to do this?
2020-05-11 04:18 AM
You should probably use Model::tick() to inspect message queues and react accordingly, in order to have the logic bundled nicely together.
/Martin
2020-05-13 06:17 AM
Thanks Martin
2020-05-21 08:13 AM
I'm having a similar issue regarding switching screen.
in My GUI, i have Screen one and Screen two,
1- in screen one i set an interaction for changing the current screen (to screen two) by hardware button and i generated the code correctly and i found the next API
//Handles when a key is pressed
void Screen1ViewBase::handleKeyEvent(uint8_t key)
{
if(0 == key)
{
application().gotoScreen2CoverTransitionEast();
}
}
2- i used this handleKeyEvent(0) (in certain event) , in the screen1 view, but i didn't succeed to switch the screen2.
3- after debugging , i found that i actually go to the screen two setupScreen, the screen doesn't appear on the lcd.
Q: i want how ask how to use handleKeyEvent() properly ? do i use it in the screen view or the presenter or the model?