Richtextfx: Feature: Change padding values at run time

Created on 2 May 2018  路  7Comments  路  Source: FXMisc/RichTextFX

at InlineCssTextArea
I need to set px values by java code not css, what are the methods?
.styled-text-area .paragraph-box .paragraph-text { -fx-padding: 0px 0px 0px 0px; }

.styled-text-area .paragraph-box:last-paragraph .paragraph-text { -fx-padding: 0px 0px 0px 0px; }

.styled-text-area .paragraph-box:first-paragraph .paragraph-text { -fx-padding: 0px 0px 0px 0px; }

I tried:
setParagraphStyle(getCurrentParagraph(),"-fx-padding: 0px 0px 0px 10px;");
But I need to set other values, how can I do this?
Also do you have documents explaining the methods? Where?

enhancement

All 7 comments

Such methods don't exist. Is there a reason you're using InlineCssTextArea over something like StyleClassedTextArea?

@JordanMartinez
No reason yet
But InlineCssTextArea extends from StyleClassedTextArea!!
Is there an error in InlineCssTextArea?
Also if there are no methods, how do I change the padding values at run time?

But InlineCssTextArea extends from StyleClassedTextArea!!

Umm... Doesn't InlineCssTextArea extend StyledTextArea, which then extends from GenericStyledArea

Also if there are no methods, how do I change the padding values at run time?

First, let me say that CSS is not my strongest point. So, if I get things wrong, please feel free to correct me so I can learn.

Second, usually, one would add such information to the scene's style sheets like in the XML demo.

Third, adding such capability via java code requires putting another Consumer<? extends ParagraphBox> in GenericStyledArea's constructor (or perhaps via a property) so one can configure it (i.e. set its style) during runtime. I don't think the need for this has arisen up until now because of point 2.

I think it's important to add something like this (change the values at runtime).
Do you also have documents or books explaining classes and methods?
I'm a beginner in rich text fx and I want to learn. Thank you

Do you also have documents or books explaining classes and methods?
I'm a beginner in rich text fx and I want to learn. Thank you

How deep do you want to go?

  • Shallowest understanding

    • Read through every page listed in the sidebar on the wiki, excluding a few irrelevant ones (i.e. "Adding Emojis" and "Known Issues"). Some things documented here might be out of date, but it'll give you a general starting place for terminology and whatnot.

  • Somewhat deeper understanding

    • Read through a tutorial I wrote for ReactFX that explains what EventStream and Val/Var are.

    • Read each package's javadoc and their See also tags, which link to the important/foundational classes upon which others are built or to which they refer, in the following order: org.fxmisc.richtext.model (the model), org.fxmisc.richtext (the view), org.fxmisc.richtext.events/util (miscellaneous things).

  • Deeper understanding

    • Look through the tests in the integrationTest package to get an idea for the API

    • Check out all of RichTextFX's dependencies as that will help you understand how it works. Besides ReactFX, Flowless is the next important. UndoFX and WellBehavedFX can be studied only when necessary.

I think it's important to add something like this (change the values at runtime).

I agree (though it will take some work to do). I think this project supports a lot of CSS but doesn't always provide a property that one can modify to change such a value at runtime.

I'm going to flag this is a feature request now. Please update the title to reflect that.

@saifalmutory I've taken my comment and integrated it into the Home page on the wiki after glancing through some of those pages. Let me know what made sense / did not make sense so we can clean it up where needed.

Was this page helpful?
0 / 5 - 0 ratings