2025-05-19 2:36 AM
Hello All,
I am new to touchgfx and looking to implement something where a array of structure containing name and other parameters to display. I need to display parameters on selection of the names displayed.
I have a created a container and able to update the parameter names to the textarea of scrollist as in picture.
Now i need to implement a way where user can select any one Preset name and those corresponding parameters should load to the respective area. as in image attached.
Just let me know the way to do it will try out things as suggested.
2025-05-19 3:45 AM
Hello @ShivDesh ,
Now that you have your scroll list, all you have left to do is to execute code when an element is pressed.
You can do that with the setitempressedcallback function.*
You can see how to do that in this tutorial or in the scrollList example :
Regards,
2025-05-19 5:20 AM
Hello @GaetanGodart ,
Thanks for the quick reply,
I am using scroll list for displaying the Names, tried to go through the link you send but still it's not clear if the (setitempressedcallback) can be used for Scroll list, for scroll wheel it can be used.
if you could please explain or provide any example for scroll list items to detect press, I can try to do same and update you.
Regards,
Shiv
2025-05-19 5:32 AM
In the scrollList and scrollWheel example, we do update the image when we press one of the scrollList item.
I think this is this part of the code:
Basically, just use the setItemPressedCallback, create a handler for it and then a switch case.
This is also what we do in the tutorial I shared but in the tutorial we use a scrollWheel (this is basically the same).
Regards,
2025-05-20 5:13 AM
Hello @GaetanGodart ,
Thanks for the direction you have provided.
I have created some function(in my ScreenView.cpp to be used for callback when user presses any index in scrollist) These functions till needs to be mapped to the setItemPressedCallback and its handler. I tried to modify and add handler for the Screenviewbase.cpp but touchgfx doesn't allow. (as its generated by designer)
Kindly let me know, how to add the handlers and set setItemPressedCallback to the respective function.
Right now I can see only one callback related to scrollist in ScreenViewBase.hpp which is below one
virtual void load_parameters_scrollListUpdateItem(load_options_CustomContainer& item, int16_t itemIndex)
{
// Override and implement this function in MainMenuScreen
}
Please correct me if I missed something to do.
2025-05-20 5:27 AM
Hello @ShivDesh ,
You should not modify the files ending in "Base" as they are generated and will be re-generated every time so your changes will be overwritten.
Please, follow this tutorial to see how to use the callback.
If you still have questions after following the tutorial, have a look at the elevator demo where we implement a scrollList :
Regards,
2025-06-02 1:53 AM
Hello @ShivDesh ,
Have you been able to move forward on your project?
Regards,
2025-06-04 3:51 AM
Hello @GaetanGodart ,
Sorry was not available for 2 days.
Yes able to detect the touch for scroll list.
Now facing other problem with displaying the Elements in scroll list.
I need to have 50 elements to be stored and display in scroll list, for 6 elements not facing any problem but after adding more items to display getting this error.
Could you guide me on this?
2025-06-04 3:58 AM
Hello @Shiv09 ,
No problem! :)
It looks like it is trying to access an element that is "out of range" so not in the range 0 to SIZE.
Can you share the project so I can see if I can reproduce the issue?
Can you easily reproduce the issue?
Do you know from what amount of element the issue appears?
Regards,
2025-06-06 5:57 AM
Yes, but the Project has many other unwanted things which are not related to Scroll list and all.
Will share you the screen shots or only required files.
Hope that will be fine.