Setting the vertical (horizontal as well?) scrollbar positions
See original GitHub issueFor 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:
- Created 8 years ago
- Comments:8 (2 by maintainers)
Top GitHub Comments
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 theselectRange
inPlatform.runLater
, that will give you the desired result. Also note that the range is given in character indices, not line numbers.In the code that results from user’s interaction after the text area has already been shown, you will not need
Platform.runLater
anymore.Thanks!