-
Notifications
You must be signed in to change notification settings - Fork 236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Setting the vertical (horizontal as well?) scrollbar positions #130
Comments
As far as I know you can only position the caret and that should set the
|
@melkhaldi hmm, I have searched again but cannot find how to set the caret position either :( And the demo code doesn't seem to show it. Any hints? |
@melkhaldi is exactly correct why this is not supported: the visual details (such as scroll position), are handled by a skin, which a user could change for their own custom skin, and the text area does not know how to work with that skin. This has been a problem often enough that I'm leaning towards moving all the functionality from the Skin to the Control itself and not use Skin at all. See also this discussion at openjfx-dev (no response from an Oracle employee yet). Putting StyledTextArea in a ScrollPane does not work, because StyledTextArea does not return meaningful preferred size. This is because to calculate the total size, it would have to render all the content, but StyledTextArea only renders what is necessary (currently in the viewport). Scrollbar lengths and positions are then just an estimate based on the sizes of already encountered paragraphs. For fixed sized font and no line wrapping, the height estimate happens to be precise, though. Does the suggested workaround of repositioning the caret work for you? |
@TomasMikula yes it works; this is in fact better than having to position a scrollbar since I don't have to calculate the offset anymore! Thanks! Closing. |
I want to be able to set the scroll to the top or the bottom of a InlineStyleTextArea. By the looks of this thread, "moveTo(..)" should do the trick. But it doesn't work for me. I've also tried "selectRange(..)" and "positionCaret(..)". This is my test program, have I misunderstood the "workaround of repositioning the caret"?
|
The problem with your example is that the
In the code that results from user's interaction after the text area has already been shown, you will not need |
Thanks! |
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 aTextFlow
, 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?The text was updated successfully, but these errors were encountered: