cancel
Showing results for 
Search instead for 
Did you mean: 

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

Shivani
Senior

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?

16 REPLIES 16
MM..1
Chief II

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. 

HP
Senior III

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

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

When this account seems to be inactive, try @tdecker2 - ST can't change mail addresses, so I had to create a new account.

Hello @Shivani ,

Of course you can 🙂 I've found this message from another thread that describes how to change your screen after some ticks for example. Doesn't require any buttons or widgets if it's what you need.

Osman SOYKURT
ST Software Developer | TouchGFX

Aaah, nice! thanks 🙂

Switching a screen seems easy on the surface, but the problem is that the above calling convention does not work from C code (for instance if you want to call it form your own task in freertos.c). Unsurpisingly the compiler does not understand a static cast, and after all we would call a method from a class.

Sorry if that sounds basic to you, but I have problems to mix and match all the .c and .cpp code. calling .c from  .cpp code seems easier (by using the "extern C" keyword).

Is there a direct calling convention in C from which you can call a method such as gotoScreen2ScreenNoTransition(), for instance through a function pointer ?

Or is is just the case that I would need to implement a function that adhers to c-calling conventions in FrontendApplication.cpp, this function would then call the gootScreen...() method internally? I guess that this function would need to be defined outside the FrontendApplication class or as a static member of the same?

It seems that alternatively I would have to implement a mesage queue in order to send the desired page with xQueueSend(), which would then be intercepted by tick() in Model.cpp(??) and which would then still presumably need  some implementation of a override of a virtual function such as SwitchScreen() (no idea where this would be implemented)  in frontendapp.cpp or in one of the presenters? Surely, there must must be a reasonably easy way to switch screens.

 

 

 

 

Clem1
Associate III

Further to my post I have managed now to call that function from Model.cpp by including

#include <touchgfx/Application.hpp>
#include <gui/common/FrontendApplication.hpp>

and calling 

 

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

in the Model::tick method. This worked, but when I tie this to a received a message over the queue through osMessageQueueGet() then I cannot get it to work. I also wonder if there is an easier way that does not need the Model tick callback.

 

In principle I would not need synchronization with the tick, as I am not updating the view, but rather change the entire screen and could do this from my own task, correct? When trying to write my own user code into a .cpp file (and declaring the entry function wtih an extern "C" linker instruction, the project builds nicely, but the screen does not change. I wonder if anyone could help me out there. Am I missing some invalidate function?

Thanks for your help.