2021-05-18 03:12 AM
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!
2021-05-18 05:53 AM
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; ?
2021-05-19 03:17 AM
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
}