cancel
Showing results for 
Search instead for 
Did you mean: 

allowVerticalDrag() doesn't work on scroll list

nico23
Senior II

The same issue has been reported years ago https://community.st.com/t5/stm32-mcus-touchgfx-and-gui/method-allowverticaldrag-in-scroll-list-container-does-not-seem/m-p/169035#M10136

If you create a mySelectorScroll and in the code mySelectorScroll.allowVerticalDrag(false); the scroll list will continue to be scrollable no matter what

Also, accoridng to docs (https://support.touchgfx.com/docs/api/classes/classtouchgfx_1_1_scroll_base#function-allowverticaldrag) it should be OFF by default

 

enableIf true, vertical scrolling is enabled. If false (default), scrolling is disabled.
9 REPLIES 9
GaetanGodart
ST Employee

Hello @nico23 ,

 

Can you try to call 

mySelectorScroll.childGeometryChanged();

 

I had a similar question where someone asked why the scrollbar width did not update after he changed it and it solved the issue :

scrollableContainer1.setScrollbarWidth(20);
scrollableContainer1.childGeometryChanged();

Somehow, the scrollbar is a child of the scrollableContainer and therefore need to be updated.

 

If that doesn't work, can you tell me what is "mySelectorScroll"? Is it a standard scrollList or is it a custom container?

 

Regards,

Gaetan Godart
Software engineer at ST (TouchGFX)
nico23
Senior II

Hi @GaetanGodart 

I'm using a standard Scroll List, not a Scrollable Container and I feel, according to docs (https://support.touchgfx.com/docs/api/classes/classtouchgfx_1_1_scroll_list) it has not that method.

Also, I'm not setting the height/width dynamically.

The Scroll List uses as items a custom container.

A workaround seems to be settings accelerations to 0

mySelectorScroll.setDragAcceleration(0);
mySelectorScroll.setSwipeAcceleration(0);

 

The scrollList inherit from drawable which have the method childGeometryChanged :

GaetanGodart_0-1745936491548.png

 

Setting the drag speed to 0 indeed prevent any movement, that could be a workaround for you. :)

 

Have you tried to call childGeometryChanged() though?

 

Regards,

Gaetan Godart
Software engineer at ST (TouchGFX)
nico23
Senior II

I've called 

mySelectorScroll.childGeometryChanged();
mySelectorScroll.allowVerticalDrag(false);

but the issue persisted

Can you try to put the childGeometryUpdate after the allowVerticalDrag?

 

Regards,

Gaetan Godart
Software engineer at ST (TouchGFX)

same, the issue persisted

EDIT: on another note, why the docs says the drag should be OFF by default when it is clearly not? @GaetanGodart 

Hello @nico23 ,

 

I have made some test and it seems that this function is not really doing much.
Perhaps it was used earlier but not anymore, perhaps it is used for other scrollable elements but not the scrollList or something else.

Either way, I will talk to the team to see what we can do about it.

To be clear, your goal was to prevent scrolling of the scrollList?
If setting the drag and swipe acceleration to 0 achieved your desired result, I guess we can keep it like that and select your previous message as "best answer".

 

Regards,

Gaetan Godart
Software engineer at ST (TouchGFX)

@GaetanGodart wrote:

To be clear, your goal was to prevent scrolling of the scrollList?


That's correct.

 


@GaetanGodart wrote:

If setting the drag and swipe acceleration to 0 achieved your desired result


It does, but it's technically a workaround.

If you're not planning to fix it, I would genuinely ask to fix the docs and/or remove the allowVerticalDrag method to avoid any other confusion.

Thanks

Hello @nico23 ,

 

I am glad that setting the acceleration speed to 0 achieves your desired result. :)

 

I will talk with the team to see what we should do with the allowVerticalDrag.
The API is generated from the source code based on our functions' and variables' description, that is why it is still in the API and that is why it is not very easy to modify the API.

 

Regards,

Gaetan Godart
Software engineer at ST (TouchGFX)