2020-08-19 07:30 AM
How to switch the screens in touchgfx using hardware button .
I have tried it by creating queue but its not working. Can anyone share the reference code for the same.
Thank You
Solved! Go to Solution.
2020-08-20 01:00 AM
Hello,
To propagate the hardware button event to your UI, please refer to : https://support.touchgfx.com/docs/development/ui-development/touchgfx-engine-features/backend-communication as well as https://support.touchgfx.com/docs/development/board-bring-up/example-gpio#touchgfx-hal-development
Also you can look at the Application Template for L496G-DISCO available in TouchGFX Designer that implements a buttonController called KeySampler.
An easy way to do the transition after you received correctly the button event, is to create a dummy button outside the screen in the Designer and create a screen transition when this button is clicked. Then just copy paste the generated code line that looks like goToScreenxxx() in your handleKeyEvent() function.
Also please look at older posts before posting this kind of question. I'm pretty sure it was answered several times before.
/Alexandre
2020-08-20 01:00 AM
Hello,
To propagate the hardware button event to your UI, please refer to : https://support.touchgfx.com/docs/development/ui-development/touchgfx-engine-features/backend-communication as well as https://support.touchgfx.com/docs/development/board-bring-up/example-gpio#touchgfx-hal-development
Also you can look at the Application Template for L496G-DISCO available in TouchGFX Designer that implements a buttonController called KeySampler.
An easy way to do the transition after you received correctly the button event, is to create a dummy button outside the screen in the Designer and create a screen transition when this button is clicked. Then just copy paste the generated code line that looks like goToScreenxxx() in your handleKeyEvent() function.
Also please look at older posts before posting this kind of question. I'm pretty sure it was answered several times before.
/Alexandre
2020-10-29 07:17 AM
Hi,
After getting the code, what is the corrct process to change the UI screen with a hardware button.
Came accross some queries, but didnt understood properly. Please help me through this
//Handles when a key is pressed
void Screen1ViewBase::handleKeyEvent(uint8_t key)
{
if(1 == key)
{
//Interaction2
//When hardware button 1 clicked change screen to Screen2
//Go to Screen2 with no screen transition
application().gotoScreen2ScreenNoTransition();
}
}
2020-10-29 10:19 PM
What do you not understand in this piece of code ? Also this is some code generated by TouchGFX Designer because you created an interaction in Designer for a hardware button pressed. This must not be changed manually.
/Alexandre