question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Setting the vertical (horizontal as well?) scrollbar positions

See original GitHub issue

For this project, right now I use a TextFlow to insert decorated fragments of text.

When a parsing node is selected, I change the text content into the TextFlow and set the relative vertical scrollbar position so that the beginning of the match, or failure, is visible.

But I can’t do that with RichTextFX as far as I can see.

The problem is that in order to better highlight the match, I change the text entirely. I collect the fragments, build the new string and .clear() then .appendText(), this works, I get the new text; and I can style it correctly.

But the scrollbar always jump to the bottom and I can’t get it to position where I want; moreover, if I try and insert the widget into a ScrollPane (which is what I do with a TextFlow, and which is how I can position the scrollbar), the widget doesn’t size correctly…

So, do I have to use a ScrollPane anyway? Or how do I position the scrollbar to where I want?

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
TomasMikulacommented, Oct 9, 2015

The problem with your example is that the moveTo/selectRange work-around does not work before the skin is instantiated. If in your example you surround the selectRange in Platform.runLater, that will give you the desired result. Also note that the range is given in character indices, not line numbers.

Platform.runLater(() -> area.selectRange(10000, 10100));

In the code that results from user’s interaction after the text area has already been shown, you will not need Platform.runLater anymore.

0reactions
isjnscommented, Oct 12, 2015

Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Change the Position of Scrollbar using CSS
We can use the CSS “::-webkit-scrollbar” property which is responsible for changing the shape, color, size, shade, shadow, etc. of the scroll ......
Read more >
Position Vertical Scrollbars on Opposite Side with CSS
The trick here is to have the scrolling parent element use direction: rtl (or the opposite of whatever your primary direction is), and...
Read more >
horizontal scrollbar on top and bottom of table - Stack Overflow
it's a really nice solution if you only have a horizontal scroll, but if you have a vertical too, the vertical scroll is...
Read more >
scrollbar-gutter - CSS: Cascading Style Sheets - MDN Web Docs
The scrollbar-gutter CSS property allows authors to reserve space for the scrollbar, preventing unwanted layout changes as the content grows ...
Read more >
ScrollBar QML Type | Qt Quick Controls 6.4.1
ScrollBar is an interactive bar that can be used to scroll to a specific position. A scroll bar can be either vertical or...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found