-
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
Changing the text area height depending on fixed text size #405
Comments
I don't think anyone responded to this after you posted because they probably did not understand what your question was. What do you mean by "a styled text area that has a high that depends on the text?" What do you mean by "high?" That's the part of your question that I do not understand. |
I mean the height. I mean the number of the lines multiplicated with the style. Can you understand that? |
You seem to be asking, "How do I set the |
Yes, that I want to know. The StyledTextArea is not editable. |
What are you using for the text style class? In other words, what is the second parameter in your area? StyledTextArea<ParagraphStyle, TextStyle> area = // What is |
I call the following constructor: new StyleClassedTextArea(true). That constructor call: public StyleClassedTextArea(boolean preserveStyle) { |
Ok, so you're using EventStream<Double> fontSize = // parses CSS for font size
EventStream<Double> lineSpacing = // parses CSS for line spacing
EventStream<Integer> nLines = // constructed from a Var or something else
EventStream<Tuple3<Double, Double, Integer>> lineHeight = EventStreams.combine(fontSize, lineSpacing, nLines);
lineHeight.map(tuple3 -> {
double size = tuple3._1;
double spacing = tuple3._2;
int numLines = tuple3._3;
return (size + spacing) * numLines;
}).feedTo(area.minHeightProperty()); I'm not sure how to parse the CSS manually to get the required values, but does this give you a better idea for what you need to do next? |
I am using the branch with the getParagraphLinesCount method. But it doesn't work. Either the getParagraphLineCount returns the number of signs if wrap text is true or it returns 1 if wrapText is false. |
@sherzfel Try to
|
#501 may help with this as you don't need to use reflection to get the size of visible cells. |
Closed via PR 944 |
Hello,
I need to have an styletextarea that has an high that depends on the text, that is written in once by initialization. The text is not editable and is written once by initialization. The width is fixed und the wrapping property is set to true. How can i calculate the desired high of the styledtextarea?
Please I need urgent help, because my boss is sitting on my table.
The text was updated successfully, but these errors were encountered: