cancel
Showing results for 
Search instead for 
Did you mean: 

How to implement callback for setAnimationEndedCallback?

IMich
Associate II

Hi,

I use scrollList1.animateToItem (cursorpos, 14); and I need to wait for the animation to ended. I saw examples of implementing callback in user code for boxMoveAnimationEndedCallback and boxFadeAnimationEndedCallback here https://support.touchgfx.com/docs/development/ui-development/touchgfx-engine-features/mixins/#callback-implementation-in-user-code but its little different and when I tried implementing callback for setAnimationEndedCallback it was without success. If someone could share an example or how to do it, it would be very nice, thank you!

2 REPLIES 2
IMich
Associate II

How can I write Callback for setAnimationEndedCallback(GenericCallback<> & callback) ?

Is GenericCallback <void> & animationEndedCallback; right or I need use something like Callback <Screen1View, const touchgfx:: ScrollBase> & animationEndedCallback; ?

IMich
Associate II

Here's a workaround that can help someone:

Screen4View.hpp

public:

   // Declaring callback handler for animation ended

   void animationEndedHandler();

protected:

   // Declaring callback type of animationEndedCallback

   Callback <Screen4View> animationEndedCallback;

Screen4View.cpp

Screen4View::Screen4View() :

   // In constructor for callback, bind to this view object and bind which function to handle the event.

   animationEndedCallback(this, &Screen4View::animationEndedHandler) {

}

void Screen4View::animationEndedHandler() {

   //Implement what should happen when animation ended

}