Nested Scrollbase
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-05-22 1:22 PM
I am trying put a ScrollWheelWithStyle inside a ScrollContainer.
Currently I can't find a method to pass down dragEvents from the Container to the Wheel.
I tried disabling the scrolling for the Container.
This cause the areas to initiate the draggable to be within the Wheel but the event is still handled by the Container.
I also tried to change the code found in "...\touchgfx\framework\include\touchgfx\containers\ScrollableContainer.hpp", that cause the application to crash in both Simulators.
Does anyone have recommendation on how to have nested Scrollables?
- Labels:
-
TouchGFX Designer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-05-23 4:04 AM
Hello @Marc_LM ,
I see 2 ways to do that.
- Create your elements as custom container
I have tested it.
Create your scrollableContainer and instead of adding your ScrollWheel, create a new custom container that is just your ScrollWheel, then add that custom container to your scrollableContainer - Loop through your children and check if you clicked on one
I have not tested this one, it will take mroe time to implement.
When you start a drag with your finger, TouchGFX will first get a click event of type click, then it we get the drag and finaly when you release your finger it will get a click event of type release.
So you can use the handleClickEvent, check whether it is a click or a release and if it is a click iterate through your children to see if you clicked on one of your children. If you do, change a value to true and set your scrollableContainer to not scrollable, also implement the handleDrageEvent to redirect the drag new X and new Y to your element.
Then, we you get a release, set your scrollableContainer scrollable again.
To see how to implement the second option, you can look at :
- the slider custom container to see how to use handleClickEvent and handleDragEvent
- this answer 's second code to see how to iterate through the children
I hope this helps you.
If it answers your question, I inivite you to select this post as "best answer".
Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-05-23 7:18 AM
Thank you for the suggestion.
I just tried to add a ScrollableContainer as a parent to the slide (example 1).
It too suffers from what I see were the ScrollableContainer starts to drag .
The ScrollableContainer is the culprit that does not propagate the click/drag to its children properly.
I'll take this into advice and remake a new ScrollableContainer.
Side note:
@GaetanGodart, I noticed a bug in the slider. I can just click at the right of it and it will trigger its completion. No sliding required. Not sure I will have time to send you a patched version to explain the bug.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-05-23 2:35 PM - edited ‎2025-05-23 2:38 PM
I could not change the ScrollableContainer itself but after cloning it and modding it, I nearly got something reasonable where click/drag propagate to children first.
If anyone know how to check if "handle*Event", is processed or not by their children.
I could use that check to enable dragging to children who do not handle them.
Looked into uninitialized vTable entries for object, but all reference discourages as being non-portable.
Any alternative would be welcome.
I am attaching the changed .hpp/.cpp for posterity.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-05-26 2:32 AM
Hello @Marc_LM ,
The slider behavior is not a bug.
If you add a slider (without a scrollable container) and press on the bar itsleft (not on the rectangle that moves), the rectangle that moves will snap to where you clicked.
This has recently been brought to TouchGFX's attention that this is not the prefered behavior and we will discuss what is the best implementation.
I am no aware of something telling you that a child entered handleXxxEvent.
However, you could clone the widget you want and modify their implementation of that event handler function to send some kind of signal of your choice :
Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2025-05-27 11:32 AM
Hi @Marc_LM
This post has been escalated to the ST Online Support Team for additional assistance. We'll contact you directly.
Regards,
Billy
