cancel
Showing results for 
Search instead for 
Did you mean: 

Swipe Container selected page callback.

Luk35
Associate III

Hello,

It would be nice to have a callback with selected page id from the Swipe Container. Now there is no way to know which page is selected. I need to know this because some constant (outside swipe container) widgets are depended from selected page.

5 REPLIES 5
Martin KJELDSEN
Chief III

Hi @Luk35​,

The SwipeContainer source code is available to you. You could add your own callback that sends back the current index once a "page" is swiped in. You'll find that the page index is used in several places (For the PageIndicator, among other things).

/Martin

Luk35
Associate III

@Martin KJELDSEN​, I had made it that way, but it will be nice to have this by default. It will be easier to update TouchGFX.

After modification I have problem with linking for simulator. For target device it works. Could you help me?

Linking build/bin/simulator.exe
build/MINGW32_NT-6.2/gui/src/screensetuptraining_screen/ScreenSetupTrainingView.o: In function `ZN23ScreenSetupTrainingViewC2Ev':
[...]\TouchGFX/gui/src/screensetuptraining_screen/ScreenSetupTrainingView.cpp:34: undefined reference to `touchgfx::SwipeContainer::setPageSelectedCallback(touchgfx::GenericCallback<unsigned char, void, void>&)'
build/MINGW32_NT-6.2/gui/src/screensetuptraining_screen/ScreenSetupTrainingView.o: In function `ZN23ScreenSetupTrainingView21nextPageButtonOnClickEv':
[...]\TouchGFX/gui/src/screensetuptraining_screen/ScreenSetupTrainingView.cpp:75: undefined reference to `touchgfx::SwipeContainer::getCurrentPage() const'
build/MINGW32_NT-6.2/gui/src/screensetuptraining_screen/ScreenSetupTrainingView.o: In function `ZN23ScreenSetupTrainingView21prevPageButtonOnClickEv':
[...]\TouchGFX/gui/src/screensetuptraining_screen/ScreenSetupTrainingView.cpp:86: undefined reference to `touchgfx::SwipeContainer::getCurrentPage() const'

Hi @Luk35​,

When compiling the simulator, it links with the touchgfx framework, in which we have included all our standard widget.

For the simulator to work, you need to add the SwipeContainer source code to the simulator makefile (if using GCC) or the the MSVS simulator project.

/Anders

Hi @Anders Nedergaard PETERSEN​,

It works. Thank you!

SBACO
Associate III

@Martin KJELDSEN​ 

I am sorry to re-open this topic, but I wanted to do the same thing.

I modify the swipeContainer located in "touchgfx\framework\source\touchgfx\containers" to retrieve the current page or get a callback. I wanted also to add a animatedMoveToPage.

However, I add a basic function in it to return the page index and call it from my view, but the linker is not able to find the function so I got an error. It looks like the source code provide is not the one really used. It looks like it is integrated inside the library of touchgfx itself. Am I right ? I suppose it is because it is included inside the designer application ?

So I made a copy of the swiperContainer to my project and rename it, add my functions and then it works. Is that how we are supposed to do it ? The only problem with that, I can't use the designer anymore to have my swiperContainer layout.