2023-07-11 05:47 AM
I have to replace the touch screen gestures with hardware buttons іn "SwipeContainer" ;
- sorry, but I couldn't find any native actions that can change the the pages in this container (in Designer4.22.0), so I tried to do it by my own.. Using "setSelectedPage" works pretty well, but it doesn't animate the pages.. So the question is, what's the best approach to make "swipe container" pages animated by the hardware keys?
2023-07-12 05:20 AM
-just created in TouchGFX Designer a simple one Swipe Container project consisted of a few of pages.. It works fine from the scratch on Discovery Board ,but seems all the process is buried in binaries with no external hooks, from the gesture handling up to page changing.. After swipping by the touch it juggles the private methods like animateRight(), adjustPages() and tick event handler , but how to invoke the same action by pushing a button remains for me unknown ..
2023-07-13 06:40 AM
Hello @DZhuk.3,
That's unfortunately not currently possible with TouchGFX.
You could trigger actions with the press on a HW button of course coupled with the right trigger in the Interaction pane, like it is described here and here, but there is no method to swipe automatically to the next/previous page for the moment.
I think it is a good idea though, and will report it to my colleagues for a further implementation :)
Sorry for the inconvenience.
2023-07-13 07:16 AM
Actually, there seems to be a way to do what you want by modifying slightly the framework code in your project.
Navigate to Middleware/touchgfx/framework/include/touchgfx/containers/ and open SwipeContainer.hpp.
Add the goLeft() and goRight() methods in the file :
Then, you just need to get a trigger when you click your HW button and call the swipeContainer.goLeft() or swipeContainer.goRight() method.
Please let me know if that helps you.
2023-08-22 02:44 AM
Hello @DZhuk.3 ,
Does my colleague's answer help you? Have you succeeded in making what you want?
I was thinking about another solution which could be to use a Scrollable Container instead of Swipe Container. With a Scrollable Container you can use the doScroll() function which will move the position of your visible window.
For example, using it inside a handleTickEvent, you could do like :
void Screen1View::handleTickEvent()
{
if (buttonIsPressed)
scrollableContainer1.doScroll(-1,0);
}
Let me know if that helps you.