0 votes

I need to scroll (at the beginning) from GDScript components RichTextLabel, ItemList. How to do it?

in Engine by (358 points)

1 Answer

+2 votes
Best answer

A quick look at the documentation revealed that in case of RichTextLabel, you can call get_v_scroll(), which should give you VScrollBar object. You can then call VScrollBar.set_value(0.0). Another way would be to call RichTextLabel.scroll_to_line(0).

I don't know if ItemList provides it's own scroll bar (I didn't use it so far) but because it looks it doesn't, I would try to put ItemList in ScrollContainer and then call ScrollContainer.set_v_scroll(0). I didn't test the code but it should give you a good idea how to scroll those nodes.

by (830 points)
selected by

ItemList does have a scroll bar but it only appears when you have more items then can fit in the bounds of the node. So it makes sense that you've never seen it. That said, looking in the documentation I don't see a get_v_scroll() function.

GlaDOSik Thank you. With RichTextLabel it works. At the ItemList added appeal to github.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.