Skip to main content
Associate III
July 3, 2023
Question

How to switch the Screens in TouchGFX Designer without adding any buttons or other widgets?

  • July 3, 2023
  • 6 replies
  • 8916 views

Hello,

In the Touch GFX Designer, I have taken the total of four screens. In the first screen, I have added a background image to it. Next I have taken a box and added some color to it.

Then I have done same with the other three screens. I have taken box in each screen and filled different colors to the box after adding a background image to the Screen. I also added interactions to change the Screen by wiping and given directions to wipe the every Screen and finally tried to run the simulator, but only the first screen could be able to seen in the simulator and switching the screens is not getting in the simulator.

 Is it possible to change the Screens without adding of buttons? If so, How?

6 replies

jumman_JHINGA
Senior III
July 3, 2023

to Change screen without any interaction use this:

static_cast<FrontendApplication*>(Application::getInstance())->gotoScreen2ScreenNoTransition();

here you have to replace "gotoScreen2ScreenNoTransition()" this with your screen name.

Senior II
July 3, 2023

If the  gotoScreen[...]-functions are not created by TouchGFX Designer, add an Interaction without trigger and action for change screen and then it will:

change screen interaction.png

jumman_JHINGA
Senior III
July 3, 2023

if you generate the code according to above settings goto[..] function will get created in generated folder.

check FrontendApplicationBase.cpp file there you'll get yours goto... function for screen

Osman SOYKURT
Technical Moderator
July 3, 2023

Hello @Shivani ,

I'd also go for custom action and interaction as suggested by @t.decker.

Osman SOYKURTST Software Developer | TouchGFX
ShivaniAuthor
Associate III
July 7, 2023

Hello @Osman SOYKURT ,

As suggested by the @t.decker I have tried with the interactions to change the screens. But the screen is not switching from Screen1 to Screen2.

When I have tried in the simulation only the box that I have added in the Screen 1 is seen in simulator.

And I have not added any interactions or actions in Screen2.I have added an action and an interaction suggested by @t.deckerI have added an action and an interaction suggested by @t.deckerscreen2.pngsimulator.png

MM..1
Chief III
July 7, 2023

Hurry up. Start learn howto interractions use. For example create two interractions 1. Delay initiated on screen load

2. change screen after 1 ends

MM1_0-1688712746973.png

 

ShivaniAuthor
Associate III
July 7, 2023

Is it not possible to change the screens without using any buttons or widgets? In my application i have not added any buttons etc. in the screens.

MM..1
Chief III
July 7, 2023

I show you howto do this , what youu dont uderstand?

Graduate II
July 7, 2023

Hello. How you then want to trigger the screen change...wiping to left/right ?

HP_it
Senior II
July 8, 2023

I have solved this by having a button off-screen that implements the interaction. This way you can make sure the appropriate code gets generated. The transition method can be called like stated above but but having the invisible button you will have the animation generated as you want

Senior II
July 10, 2023

Hi @HP_it, you dont need a hidden off-screen Button to get the changescreen-Function generated. Just create an Interaction and let the Trigger unselected.

MM..1
Chief III
July 8, 2023

And additional info use Delay interraction is good only for intro screens or info , that disapear automatic after defined delay. For control switching screens in normal code you define interraction to hardware button (will virtual dont exist in your design only in code) and if you choice ASCII char for example X , then in simulator you can test it with X on keyboard. 

Visitor II
November 7, 2024

To change screens using code in ToughGFX Designer, you need to create an action on the screen where you want the transition to happen. For example, create an action named `changeToScreen2`. Next, go to the Interactions section, set the trigger to `changeToScreen2 called`, and select the screen transition action as the interaction to switch to the desired screen. This setup will generate the corresponding code in `viewBase`. Finally, call `changeToScreen2` within the function where you want the screen change to occur.