2020-01-28 03: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
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
2020-02-18 06: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
2020-02-18 06: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
2020-02-18 07: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