2019-10-16 09:50 AM
I have gone through the methods that are gui generated when change screen transition is done through the designer. I have also gone through the previously asked question how to implement switchscreen() in touchgfx. However, sadly I don't understand exactly how to fulfill my requirement. I want to carry out transition whenever a certain boolean variable becomes true. The variable becomes true after response from the hardware. Please guide me on how to implement this. I shall be thankful.
Solved! Go to Solution.
2019-10-17 02:26 AM
Some code for checking things in Model::tick where GUIEvent is the name of the message queue, ControlMessage is a struct that contains a message code and a value
typedef struct
{
uint16_t messageCode;
int16_t messageValue;
} ControlMessage;
...
void Model::tick()
{
...
osEvent event = osMessageGet(GUIevent, 0); // Get GUIevent immediately
if (event.status == osEventMessage)
{
// handle event
ControlMessage* message = (ControlMessage*)event.value.p;
switch (message->messageCode)
{
case MESSAGE_TYPE1:
//go to type 1 screen
break;
case MESSAGE_TYPE2:
//go to type 2 screen
break;
...
}
2019-10-16 11:43 PM
Hi,
If you're looking to change screens based on some hardware input you'd typically send this through an OS message queue to the gui task and handle the message in your model on every tick - THEN do your transition. Please check out the "integrating hardware and ui" sticky - I did a webinar on this very topic last year. Then you can use the goto... code that you've found here on the forum to make the transition.
/Martin
2019-10-16 11:44 PM
2019-10-17 02:26 AM
Some code for checking things in Model::tick where GUIEvent is the name of the message queue, ControlMessage is a struct that contains a message code and a value
typedef struct
{
uint16_t messageCode;
int16_t messageValue;
} ControlMessage;
...
void Model::tick()
{
...
osEvent event = osMessageGet(GUIevent, 0); // Get GUIevent immediately
if (event.status == osEventMessage)
{
// handle event
ControlMessage* message = (ControlMessage*)event.value.p;
switch (message->messageCode)
{
case MESSAGE_TYPE1:
//go to type 1 screen
break;
case MESSAGE_TYPE2:
//go to type 2 screen
break;
...
}
2019-10-17 04:45 AM
I am actually not understanding how to make the transition with user code.
I saw the methods generated by the designer when you do transition using the designer. Now if I don't want to use designer for transition, should I leave the GUI generated methods as well and override them or delete the gui interaction and write my own function. Also in which class should I write the goto custom function.
2019-10-17 04:49 AM
There was a similar question recently, so i figured you might have seen it. Here it is:
https://community.st.com/s/question/0D50X0000BTdnsASQR/how-can-i-change-screen-in-software
2019-10-17 05:09 AM
Thanks. Going through it right now.
2019-10-19 01:19 AM
@Martin KJELDSEN I am sorry, I tried but not able to understand how to implement.
The problems are
2019-10-20 01:18 PM
Done with it. Thankyou so much for the help.
2019-10-21 02:04 AM
Glad you solved it! :)