Is there a way to hide the scroll handle in RichTextLabel, or make it "invisible" on the screen?

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

Something like the effect of RichTextLabel’s bool scroll_active = false, but with still working scrolling?

Have you looked into the scroll_to_line() function? Maybe you can set up a custom function to use scroll_to_line() when the text needs to be moved?

Ertain | 2020-03-23 08:20

I know about scroll_to_line, but it kind of “cripples” the way the RichTextLabel works.
I would want to be able normally scroll the content of RichTextLabel, but not to see the handle of the RichTextLabel.

Freeman | 2020-03-23 14:57

:bust_in_silhouette: Reply From: Adam_S

You can set the alpha value (hiding it didn’t work for me)

func _ready():
    $RichTextLabel.get_child(0).modulate.a = 0

Edit:

To make this answer more clearer.

Some nodes, like the RichTextLabel already consist of several nodes.
You can see this when running your project and switching the scene tree from local to remote.

So the VScrollBar is the first child of the RichTextLabel node, and you can make it invisible by setting its scale or alpha value to 0.

It’s worth pointing out here that making something invisible is not the same as hiding it though! You can still click in the area where the scrollbar is located and move the handle. Because of this, I would recommend changing rect_scale instead:

$RichTextLabel.get_child(0).rect_scale.x = 0

This way the scroll bar isn’t occupying any space, thus cannot be clicked and dragged around as well. However, scrolling with the mouse wheel still works fine.

njamster | 2020-03-23 14:49

Thank you @Adam_S and @njamster for taking time to answer my question.
Modulate just sets alpha to 0, let’s say that it “hides” the whole RichTextLabel. In the result the text is not visible as well.
What I meant (sorry for not explaining it better in the question) was to hide the handle of the scroll but leaving the text visible.

Freeman | 2020-03-23 14:55

What I meant was to hide the handle of the scroll but leaving the text visible

And what we proposed does precisely that! Hiding the text would be:

$RichTextLabel.rect_scale.x = 0

but here we are working on the first child of the RichTextLabel instead:

$RichTextLabel.get_child(0).rect_scale.x = 0

And this first child should always be the VScrollBar - check the remote tree!

njamster | 2020-03-23 15:02

I am doing something wrong I guess, but after issuing

$Control/RichTextLabelget_child(0).scale.x = 0 

I get
Invalid get index 'scale' (on base: 'VScrollBar') in debugger.

Probably set_scale(Vector2(0, y) would work but it is not what I am looking for.
I would like to have a normal, unscaled text, that user could normally scroll without seeing the scroll handle.
Adding VScrollBar as child does nothing, as The RichTextLabel still has a visible scroll handle.
I guess there would be possible to turn the scroll of in RichTexTLabel and set VScrollBar signals and write a function that would “move” RichTextLabel according to the signals of VScrollBar, but I was looking for a rather simple solution within the RichTextLabel itself.

Freeman | 2020-03-23 22:34

My bad, sorry! It’s rect_scale, not scale. I’ll edit my answers accordingly.

I would like to have a normal, unscaled text, that user could normally scroll without seeing the scroll handle.

And you will get precisely get that. :slight_smile: This time for real, hehe.

njamster | 2020-03-23 23:01

Please take look at my edited answer.

Adam_S | 2020-03-23 23:33

Thanks njamster, I appreciate your efforts, but I don’t get it. :frowning:
I am probably to stupid, but like I mentioned above, no matter what I do with child-VScrollBar, the parent-RichTextLabel’s scroll handle is still visible.
I don’t see any simple solution without involving signals and code checking the scroll value in every frame or something. :frowning:
If there is a solution, I guess I would need a step by step instruction with drawings :slight_smile:

Would you be willing to create a simple project example showing what you mean?
I guess with just a simple structure like:

Control
   I
    - RichTextLabel
              I
               - VScrollBar

to show me how you make RichTextLabel scroll hande not visible and text scrolling still working?

Freeman | 2020-03-23 23:42

All right! Thank you for updating the answer. Now I get it! Checking the Remote instead looking at Local. Stupid me. I had no idea what you ment by that in the first place. Now I understand. Many thanks, really! :smiley:

Freeman | 2020-03-23 23:53