Topic was automatically imported from the old Question2Answer platform.
Asked By
keke
Old Version
Published before Godot 3 was released.
Like the title says.
To avoid the XY problem:
I’m trying to create a text box that will normally follow any new stuff added, but the user can override by scrolling up/down one line at a time with the keyboard. The documentation has me pretty confused. get_v_scroll ( ) looks useful, but it returns an Object?
I’m 90% sure that get_v_scroll() returns the vertical scroll bar node itself.
What about the function scroll_to_line()?
I’m going to use that to do the actual scrolling, but to do so, I need to know the number of lines in the box - so I can do scroll_to_line(number_of_lines_in_the_box-user_offset), where the user can change user_offset with two keyboard keys. Or something like that. I could always count the lines as they are being added, but this doesn’t seem like a very elegant solution…
Maybe you want to create your own system that does what you want, instead of trying to use a RichTextLabel.
Maybe, a VBoxContainer with a number of Labels (one for each line). That way you will have full control over how many lines you want to display, and what/where each of those lines are in your data structure.
I could definitely do something like that, in fact I am temporarily using a more complicated system like the one you describe. The reason I asked this question is because if there is a way to get the number of lines in the box, it would simplify my life a lot. If there is no way to do this, thats fine, I’d like someone to confirm that before I decide to stick with my current system.