2024-09-24 09:10 AM - edited 2024-09-24 09:11 AM
Hi,
Do I need to prevent calling multiple screen transitions from event handlers as illustrated in the following pseudo code ?
Or, once the "application ().gotoOtherScreen ()" is executed in either handleTickEvent () or handleKeyEvent (), there is no way any further handler is called.
I am not sure if there is a way to check for ongoing transition. I thought I saw an API for that somewhere but cannot find it now.
So I call imaginary function "application ().isScreenTransitionInProgress ()".
// ScreenOne.cpp
void ScreenOne
::handleTickEvent () // override final
{
if ( ( true == bGoToScreenTimeout ) && ( false == application ().isScreenTransitionInProgress () ) )
{
application ().gotoOtherScreen ();
}
}
//---------------------------------------------------------
void ScreenOne
::handleKeyEvent ( uint8_t key ) // override final
{
if ( false == application ().isScreenTransitionInProgress () )
{
application ().gotoOtherScreen ();
}
}
Thanks.
Solved! Go to Solution.
2024-09-27 05:59 AM
Hello @ferro ,
I do not think you need to do that.
Simply call it in your even handler and, as far as I know, as soon as the transition starts, you are basically not in that screen anymore.
Here is the code generated by TouchGFX Generate when you add a transition from screen1 to screen2 in an interaction :
void Screen1ViewBase::buttonCallbackHandler(const touchgfx::AbstractButton& src)
{
if (&src== &button1)
{
//Interaction1
//When button1 clicked change screen to Screen2
//Go to Screen2 with screen transition towards East
application().gotoScreen2ScreenSlideTransitionEast();
}
}
Here, we do not check for current transition.
If you want to double check that, you can try to call it multiple time in a handleTickEvent.
Regards,
2024-09-27 05:59 AM
Hello @ferro ,
I do not think you need to do that.
Simply call it in your even handler and, as far as I know, as soon as the transition starts, you are basically not in that screen anymore.
Here is the code generated by TouchGFX Generate when you add a transition from screen1 to screen2 in an interaction :
void Screen1ViewBase::buttonCallbackHandler(const touchgfx::AbstractButton& src)
{
if (&src== &button1)
{
//Interaction1
//When button1 clicked change screen to Screen2
//Go to Screen2 with screen transition towards East
application().gotoScreen2ScreenSlideTransitionEast();
}
}
Here, we do not check for current transition.
If you want to double check that, you can try to call it multiple time in a handleTickEvent.
Regards,