cancel
Showing results for 
Search instead for 
Did you mean: 

How to change animation speed in swipecontainer? And Can I get the current selected page index in swipecontainer?

JPark.14
Associate III

[Q1] I have 3 pages in a swipecontainer in my program. One of them is a watch face and when I swipe a page to this watch face page, the speed of animation is too slow. So I want to change the speed of animation faster.

[Q2] And I want to get the current selected page index in swipecontainer. There is a function to set the current page but there is no feature to get the current index.

[Q3] I know there is a source code of swipecontainer but I use touchgfx_core.a and even if I change the source code, it didn't affect it. Can I build touchgfx_core.a by myself after I change the source code?

How can I get a solution about this matter? Do I make my own swipecontainer class like "SwipeContainerEx" as a subclass of the original swipecontainer?

Could you let me know better solutions?

Thanks in advance!!

J.Park

4 REPLIES 4
Alexandre RENOUX
Principal

Hello,

What do you mean by when you swipe a page it's too slow ? The speed can be changed in the source code or at least the number of steps for the change page animation.

To get the current selected page you need to store it somehow yourself in a variable or even in the Model if you want to remember at which page you were before changing to another screen. There's no function that can give you this information in the swipe container.

Unfortunately, I cannot help you regarding building touchgfx_core.a

/Alexandre

Dear Alexandre,

Thank you for your reply.

Summarizing the point of my question,

(Q1) If the page swiping speed is too slow when using the "SwipeContainer" class, what should I do to make it faster?

(Q2) --> No function from your answer.

(Q3) --> I cannot handle it from your answer.

Then, I have to make my own "SwipeContainer" or a subclass of SwipeConainer class to solve (Q1)+(Q2). Right?

Thanks in advance~!

J.Park

Hello,

Unfortunately, the variable that specifies the duration of the animation is hardcoded in the corresponding function (animateLeft() and animateRight()).

So even if you create your own class that inherits the SwipeContainer class, you won't be able to affect the speed.

Therefore, the option I can see right now is that you create your own SwipeContainer (basically copy paste everything from the .hpp and .cpp files) and change the value of the variable called duration.

I don't know if you have access to the SwipeContainer.hpp and .cpp files so I will enclose them to this message.

Regarding touchgfx_core.a, we will try to investigate.

/Alexandre

Thank you, Alexandre.

I made my own SwipeContainer class with the reference of the original SwipeContainer class code.

Now, I can change the duration of the animation.

Thank you for your advise, it was the perfect guide for solving the problem.

J.Park