cancel
Showing results for 
Search instead for 
Did you mean: 

Custom container with mixins (MoveAnimator)

Tuoman
Senior II

Hi,

How to create custom containter that has moveAnimator mixin included? Is it possible?

I want to create notification, which is operated using: notificationContainer.show()

The custom container would implement this show() method, which would call startMoveAnimation() to itself, among other stuff.

I can add moveAnimator mixin to container in this in view, but then I need to call the startMoveAnimation etc. routine in every view, instead of just calling show() and letting container deal with the implementation.

How would I create custom container class that has MoveAnimator mixin?

Designer generates it like this:

touchgfx::MoveAnimator< notificationContainer > notificationContainer1;

I cannot figure out how to create such class. 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions

Figured out that I can create container (touchgfx default Container) inside the custom container, and then I can get the MoveAnimator on that container and use startMoveAnimation. Maybe bit of a hack, but works fine.

View solution in original post

4 REPLIES 4
Martin KJELDSEN
Chief III

If you select the mixin for an instance of a custom container as you're adding it to your view - Then, in your show() function you'll start the animation., so you don't have to do it in every view.

/Martin

>If you select the mixin for an instance of a custom container as you're adding it to your view

I have checked the MoveAnimator in the Designer in this View.

>Then, in your show() function you'll start the animation

How can I do that?

startMoveAnimation() etc. is not defined within the container, only in the View. Container class hierarchy is: notificationContainer > notificationContainerBase > touchgfx::Container > Drawable.

None of these have MoveAnimator methods.

Figured out that I can create container (touchgfx default Container) inside the custom container, and then I can get the MoveAnimator on that container and use startMoveAnimation. Maybe bit of a hack, but works fine.

Ok, great! We sometimes do tricks like that, so don't worry. "Hijack" the root container to be able to do certain things. So don't be ashamed :)

/Martin