Skip to main content
IMich
Associate II
May 18, 2021
Question

How to implement callback for setAnimationEndedCallback?

  • May 18, 2021
  • 2 replies
  • 1131 views

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!

This topic has been closed for replies.

2 replies

IMich
IMichAuthor
Associate II
May 18, 2021

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
IMichAuthor
Associate II
May 19, 2021

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

}