-
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
how can i disable vertical scrolling and always show the whole text? #674
Comments
Yes, because that's what is expected for regular text editors. It sounds like you want to wrap the text so that the horizontal scrollbar never appears, correct? If so, have you turned on the text wrapping (e.g. I'm also assuming that you don't want the vertical scrollbar to stop appearing or vertical scrolling to stop working at all, correct? |
@JordanMartinez Yes, I have turned on the text wrapping and got rid of the horizontal scrollbar. Also I want to completely get rid of the vertical scrolling, because actually I just want a more powerful TextFlow instead of a text editor. Thanks for your quick reply! |
Sorry. I misread the issue's title where you explicitly state that, haha. See OverrideBehaviorDemo to know how to override the default scrolling behavior and then check out GenericStyledAreaBehavior to see what specifically you need to override to prevent the vertical scrolling from occurring. You might also need to override some of the mouse behavior hooks (e.g.
I think you mean #77 |
Since the behavior overriding is a FAQ, I've added my slight variation of my response above to a page in the wiki. |
I have similar problem as @trapchar - I want an auto-sizeable, non-scrolling, editable rich text area inside a list cell. For auto-sizing, I override the override fun computePrefHeight(width: Double): Double {
val ih = insets.top + insets.bottom
val c = children.firstOrNull() as? VirtualFlow<*, *>
if (c != null && paragraphs.size > 0) {
return ih + (0 until paragraphs.size).sumByDouble { i ->
c.getCell(i).node.prefHeight(width)
}
}
val d = totalHeightEstimateProperty().value
if (d != null) return ih + d
runLater { requestLayout() }
} Scroll events are consumed by VirtualFlow, not Behaviour: https://github.com/FXMisc/Flowless/blob/master/src/main/java/org/fxmisc/flowless/VirtualFlow.java#L185 addEventFilter(ScrollEvent.SCROLL) {
it.consume()
parent?.fireEvent(it.copyFor(it.source, parent))
} |
My steps:
|
i was using TextFlow as a cell in ListView, and make it always expand horizontally.
so texts are always as wide as the parent, and if they don't fit in one line, they wrap, take up multiple lines, take up whatever vertical space is needed, all texts are visible all the time
but TextFlow misses features, for example, i'm told the easiest way to make text selectable is to use RichTextFX
RichTextFX is powerful, but maybe too powerful, now when the text is too long, a built-in scroll mechanism kicks in. i searched around, i guess i can make it ignore certain mouse events, but i don't think that'll make the text always shown in its entirety on screen, right?
could you give me some pointers, thanks!
The text was updated successfully, but these errors were encountered: