Coder Social home page Coder Social logo

Comments (6)

TomasMikula avatar TomasMikula commented on May 21, 2024

Hi Maher,

yes, this does not work in InlineCssTextArea (or any other flavor of StyledTextArea), frankly because it's not implemented. The way it is implemented in TextArea doesn't translate to StyledTextArea, because we want to be able to set text color per range, not per the whole text area.

You can set the color of a range of text like this

area.setStyle(from, to, "-fx-fill: red;");

If you want to set a default text color for all text where the color is not given explicitly by the above method, you can do so by including the following in your application stylesheet:

.styled-text-area .text {
    -fx-fill: purple;
}

from richtextfx.

 avatar commented on May 21, 2024

Hi Thomas thanks for explaining. this makes sense. the reason why I just
tested it with a whole text for now was that I did not get to the point
where i implemented ranges yet. I spent the time rethinking the procedures
I used to have in my previous prototype. I'm almost there and should get
started on ranges soon.
I'll report back if I encounter other issues
Best regards
Maher
On Jan 26, 2014 3:45 PM, "TomasMikula" [email protected] wrote:

Hi Maher,

yes, this does not work in InlineCssTextArea (or any other flavor of
StyledTextArea), frankly because it's not implemented. The way it is
implemented in TextArea doesn't translate to StyledTextArea, because we
want to be able to set text color per range, not per the whole text area.

You can set the color of a range of text like this

area.setStyle(from, to, "-fx-fill: red;");

If you want to set a default text color for all text where the color is
not given explicitly by the above method, you can do so by including the
following in your application stylesheet:

.styled-text-area .text {
-fx-fill: purple;}


Reply to this email directly or view it on GitHubhttps://github.com//issues/10#issuecomment-33334764
.

from richtextfx.

 avatar commented on May 21, 2024

Hi Thomas,
Inline CSS does not seem to be working on ranges for me.

I did some debugging and noticed that
1 - getSelectedText() and getText() returned empty strings.

2 - range.getEnd() and range.getStart() both return 0.

Is this working for you?
Thanks,
Maher

from richtextfx.

TomasMikula avatar TomasMikula commented on May 21, 2024

Hi Maher, can you post a simple self-contained example that demonstrates the issue?
The ManualHighlighting example (gradle ManualHighlighting to run) uses getSelection().getStart()/getEnd() and it works fine.

from richtextfx.

 avatar commented on May 21, 2024

Hi Thomas, let see how to factor the code and post back.
Best
Maher
On Jan 28, 2014 3:03 AM, "TomasMikula" [email protected] wrote:

Hi Maher, can you post a simple self-contained example that demonstrates
the issue?
The ManualHighlighting example (gradle ManualHighlighting to run) uses
getSelection().getStart()/getEnd() and it works fine.

Reply to this email directly or view it on GitHubhttps://github.com//issues/10#issuecomment-33468900
.

from richtextfx.

nazmuddin avatar nazmuddin commented on May 21, 2024

Hi @TomasMikula , i have two queries.

  1. How to set different styles to words in same paragraph or line of GenericStyledArea ? I am doing it like this ....

    area.setStyle(area.getText().lastIndexOf(text), area.getText().length(), TextStyle.EMPTY.updateTextColor(color));
    This works only for first word, but when i append the second word with different style like

    area.setStyle(area.getText().lastIndexOf(text), area.getText().length(), TextStyle.EMPTY.updateTextColor(color).updateBold(true);

It also changes the style of first text. Now how to do it ?

  1. How to add different objects in same GenericStyledArea . What i mean to say is if i define the area like this
    final GenericStyledArea<ParStyle, Either<StyledText<TextStyle>, LinkedImage<TextStyle>>, TextStyle> area .
    I can insert only LinkedImage objects into this. But if i have to add lets say an Text or Hyperlink Object then how to do it. I can manage the hyperlink with styling as you explained in some pull request but if i have to add Hyperlink and I mage in area then how to do it ?

Thank you.

from richtextfx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.