cancel
Showing results for 
Search instead for 
Did you mean: 

Calling "app ().GotoScreen ()" transition from handleTickEvent () and handleKeyEvent()

ferro
Senior II

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.

 

1 ACCEPTED SOLUTION

Accepted Solutions
GaetanGodart
ST Employee

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,

Gaetan Godart
Software engineer at ST (TouchGFX)

View solution in original post

1 REPLY 1
GaetanGodart
ST Employee

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,

Gaetan Godart
Software engineer at ST (TouchGFX)