set_v_scroll() not working

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Spyrex

I have a working scroll container with content. So dragging the scroll bar with the mouse works. But calling the following code:


nothing happens, although printing the “scroll_vertical”-value says:


Why doesn’t it scroll to position 55?

:bust_in_silhouette: Reply From: bloodsign

I’ve also had some issues using the scroll containers properties. So I kinda did it in a round about way.
If you check on the remote tab during run time and check for your ScrollContainer, you should see a _v_scroll and a _h_scroll added as a child to your ScrollContainer

if you click on _v_scroll and moved the scrollbar using your mice, you’ll see that the property “value” of _v_scroll is changing.

In order to set or manipulate the scroll position. You must first access the dynamically created scrollbars generated by ScrollContainer likeso:

var v_scrollbar = $ScrollContainer.get_node("_v_scroll")

then if you want to change its value or make it move or something:

v_scrollbar.value = 100


v_scrollbar.value += 10

I’m still far from the last stages of my UI, but this was how I implemented mine.
Disclaimer: It’s far from elegant, but it works.

Here’s a sample:
Youtube: Godot ScrollContainer Touch Support and Inertial Scroll

Unfortunately your suggestion didn’t work. :frowning:
Even changing the values in the remote tab didn’t work.

Spyrex | 2021-02-13 12:43

wait that’s odd. Could you show the relevant code?
The touch scroll function in my demo uses that same code.

bloodsign | 2021-02-19 19:36