cancel
Showing results for 
Search instead for 
Did you mean: 

How to perform a Screen transition on selection of an item in a Scroll List?

Yogeshk
Associate II

I am wondering if there is a mechanism to transition to a different screen based on the item selected on a scroll list control (Widget) and also pass information regarding the item selected or the index of the scroll list item selected or is there a mechanism to do screen transition from a virtual function handler?

Thanks,

Yogesh

1 ACCEPTED SOLUTION

Accepted Solutions
Yoann KLEIN
ST Employee

Hello again,

I just created a very simple project that enables me to switch from Screen1 to 4 different screens, with a ScrollList composed of 4 items. I will join this project to this post.

To explain quickly the most important points :

  • To access the "Switch screen" functions (e.g. gotoScreen2ScreenSlideTransitionEast()), I created 4 invisible buttons on the first screen. Each of those buttons will trigger a switch screen interaction, so we can switch from screen1 to the 4 other screens. Thanks to that, we will be able to use those functions in the back-end code to switch screens whenever we want. This is a little work-around but I think that it's the easiest way to achieve what you wanna do.
  • In Screen1View.cpp, you can take a look at the function scrollListItemSelectedHandler(). This function is called every time you select an item of the ScrollList, and provides the item index. To enable the switch screen process on my application, I simply implemented a switch case that calls the gotoScreen() method which matches the selected item.
  • Finally, if you want, for example, to change the text displayed on each element of your list, please look at the setupScreen() method in Screen1View.cpp, and at the function updateText(int value), that I declared in CustomContainer1.cpp. It will help you to understand how to enable and use wildcards in TouchGFXDesigner, and how to update their values in the code.

Let me know if that helped you, or if you need more informations.

/Yoann

Yoann KLEIN
ST Software Developer | TouchGFX

View solution in original post

5 REPLIES 5
Yogeshk
Associate II

Any thoughts Toucgfx team?

Yogeshk
Associate II

one last time and see if the touchgfx team has the time to respond to this question or point me to a link if this question has already been answered before?

Thanks,

Yogesh

Hello @Yogeshk​ ,

There are several examples you can use to help you switching to another screen, after selecting a particular item in a ScrollList.

For instance, the "Scroll Wheel and List Example" in TouchGFXDesigner shows how to update an icon on the screen, which will be different for each item selected in the list.

If you wanna change the screen programmatically, there are also many posts on the forum which might help you, like this one for example : https://community.st.com/s/question/0D50X0000A1mbq6SQA/changing-screen-programmatically

Hope that this helps,

/Yoann

Yoann KLEIN
ST Software Developer | TouchGFX
Yoann KLEIN
ST Employee

Hello again,

I just created a very simple project that enables me to switch from Screen1 to 4 different screens, with a ScrollList composed of 4 items. I will join this project to this post.

To explain quickly the most important points :

  • To access the "Switch screen" functions (e.g. gotoScreen2ScreenSlideTransitionEast()), I created 4 invisible buttons on the first screen. Each of those buttons will trigger a switch screen interaction, so we can switch from screen1 to the 4 other screens. Thanks to that, we will be able to use those functions in the back-end code to switch screens whenever we want. This is a little work-around but I think that it's the easiest way to achieve what you wanna do.
  • In Screen1View.cpp, you can take a look at the function scrollListItemSelectedHandler(). This function is called every time you select an item of the ScrollList, and provides the item index. To enable the switch screen process on my application, I simply implemented a switch case that calls the gotoScreen() method which matches the selected item.
  • Finally, if you want, for example, to change the text displayed on each element of your list, please look at the setupScreen() method in Screen1View.cpp, and at the function updateText(int value), that I declared in CustomContainer1.cpp. It will help you to understand how to enable and use wildcards in TouchGFXDesigner, and how to update their values in the code.

Let me know if that helped you, or if you need more informations.

/Yoann

Yoann KLEIN
ST Software Developer | TouchGFX
Yogeshk
Associate II

Hi Yoann,

Thanks so much for taking the time to respond and writing a detailed response with an example as well :). I greatly appreciate it. I will take a look and let you know if I have any follow up questions.

Thanks,

Yogesh