Can a swipe container be triggered to change programmatically?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-01-28 3:18 PM
Either from the code, or a screen button interaction? I added a swipe container to my project and it appears to be working, but I will be using a resistive touch screen and I don't know yet how well it will interpret swipes. I would like it to be able to have both buttons and swipe.
Is there a link to the source for this example: https://www.youtube.com/watch?v=3zAS3WFp4Rs
thanks
- Labels:
-
TouchGFX
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-01-28 11:02 PM
To externally trigger a swipe, do we call void setSelectedPage(uint8_t pageIndex) ? if so we would want/need to know its current index, right?
Also, how do we make the swipe container remember what its current page is? Is there a built in feature for it? Or do we need to (somehow) pass the current page back to the model, and then retrieve it when the page with the container is re-created? I could imagine some of this logic if the page is built programmatically, but the files generated by the designer will be overwritten.
Thanks
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-02-18 6:43 AM
Hello Bob,
It is currently not possible to know the current index by calling a built-in TouchGFX function. However, it is relatively easy to code its own index handling. For that you need a variable that will take a value between 0 and NB_PAGES-1. The index 0 corresponds to the page at the bottom in the TouchGFX Designer Screens handling (where you can specify if one widget should be on top of another).
Changing pages does not require saving the index in the Model. As long as you only have one screen with a swipe container, you will never lose the index value that you update when changing page.
Calling setSelectedPage(uint8_t pageIndex) will indeed send you to the corresponding page but without any animation.
In order to have an animation left or right to the next page when pressing a button, you must implement your own swipe container based on the one from TouchGFX framework.
/Alexandre
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-02-18 6:57 AM
is the source code for the examples available (the above example, or others showing how some of the more complicated transitions and animations are done) ?
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2020-02-18 7:05 AM
In TouchGFX Designer, you can find several examples as well as demos you can start with. Then if you click on the button Generate code and then if you click on button Browse code, you will be able to see all the generated files. For instance, on the video you can see a game with a bird, this is from the demo called TouchGFX Demo 2.
/Alexandre
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-04-09 8:07 AM
I understand , that not exist in 2015, maybe too can accept it in 2020, but now i test 4.25 in 2025 and still swipe container dont have simple OnChangingPage trigger ! TouchGFX is here unusable for creating regular GUI.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-04-09 8:19 AM
Hello @Bob Bailey ,
The API of the swipe container shows me that there is a function called goNextPage and goPreviousPage.
Could these 2 function be enough for you to achieve your desired result?
Regards,
Software engineer at ST (TouchGFX)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-04-09 9:15 PM
GG Bob ask this five years ago, i mean no wait for reply, and no desired is event after page move ends...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-04-10 2:35 AM
Haha, I did not see that it was an old thread, I just saw your last message @MM..1 ! :)
Regarding your last message, indeed there is no trigger happening when a page is changed, however, there is the getSelectedPage() function that you can use to check the current page number and if it changes, you can do something :
virtual void handleTickEvent()
{
if(prevPage != swipeContainer.getSelectedPage())
{
prevPage = swipeContainer.getSelectedPage();
touchgfx_printf("Page change, now at %d.\n", prevPage);
}
}
Please find an example attached.
Regards,
Software engineer at ST (TouchGFX)
