Skip to main content
DZhuk.3
Associate
July 11, 2023
Question

Using hardware buttons with SwipeContainer

  • July 11, 2023
  • 4 replies
  • 1843 views

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?

This topic has been closed for replies.

4 replies

DZhuk.3
DZhuk.3Author
Associate
July 12, 2023

-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 ..

Yoann KLEIN
ST Employee
July 13, 2023

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.

Yoann KLEINST Software Developer | TouchGFX
Osman SOYKURT
ST Technical Moderator
August 22, 2023

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. 

ST Software Developer | TouchGFX