Simultaneous scrolling with RichTextLabel

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

I don’t understand how scrollbar works in Rich Text Label.
What I want to do is connect one scrollbar to another, so they can scroll simultaneously two different Rich Text Labels. And I want to do it with mouse wheel, in a way that only one scrollbar is visible

Apparently only mouse wheel scrolling do not trigger built-in “scrolling” signal of scrollbar, which is inherited by vscrollbar of Rich Text Label.
Apparently scrollbar inherits from Control Node, yet when it is reached via code, it ignores tasks to change its visibility or to ignore input events.
I cannot get built-in func scroll_to_line to work, while Scroll Active is off
Then it has these properties : step and custom_step, these are integers and I have no idea what can they represent, nothing close to line_count anyway.
Finally there is this property get_visible_line_count(). Print shows that is always is 1 or 0 despite number of lines that are really visible, I don’t get it at all.

It seems that every text node has different scrollbar buiilt-in mechanics…

:bust_in_silhouette: Reply From: exuin

Since the “value_changed” signal works with the scroll wheel, you should connect that signal instead. I tested simultaneous scrolling it and it works. For the second RichTextLabel, set scroll_active to false. You can set the value property to the same as the other label’s and it’ll still scroll. I’m guessing the scroll_active property overrides any calls to hide the child VScrollBar.

As for step, look at here.

As for everything else, I have no clue. Maybe you can submit an issue for the docs on github?

Thanks, I didn,t realize Range class, it seems usefull, however… I still can’t get it to work

Neither value_changed signal, neither changed signal trigger when scrolled via mouse wheel. Print shows, that these only trigger when new text forces scrollbar to show up, so two labels can simultanously do that. Did you test it on Labels with dynamic content, that start with no scrollbar ?

At least thanks to you I can now eventually force simultanousness in process()

Inces | 2021-02-22 20:38

Sorry, I didn’t test it on labels with dynamic content.

exuin | 2021-02-22 20:58

Thank You :slight_smile:

Inces | 2021-02-25 16:22