Changing Spark TextArea text color dynamically over a range of characters - apache-flex

Hoping to obtain the help of some Flex 3/4 gurus out there...
I am attempting to dynamically change the color of a subset/portion of text in a Spark TextArea control. Using the MX-based TextArea, I could leverage the mx.controls.textClasses.TextRange type and change the color directly as follows:
TextRange tr = new TextRange(theTextAreaControl, false, beginIndex, endIndex);
tr.color = somePredefindColor;
Input Parameters to TextRange constructor:
1st argument: The TextArea control that will provide access to the underlying textField property
2nd argument: Indicates the TextRange will not modify the content of the TextArea
3rd argument: The beginning index position in the TextArea text string
4th argument: The ending index position in the TextArea text string
How would I go about doing this for a Spark-based TextArea control? I am looking to dynamically change the font color for a range of text, not just the entire TextArea AND I cannot statically specify the font color. The problem I run into when trying to re-use the TextRange type is that the 1st argument is expected to provide the textField property, which is currently not on the Spark-based TextArea control. I thought about extending the Spark-based TextArea control to provide this accessor property but that seems like overkill and is probably not the best approach.
Any help would be greatly appreciated.
Thanks,
Michael

When manipulating Spark text components, you'll want to use the Text Layout Framework (TLF), which is built on top of the Flash Text Engine (FTE) that was introduced in Flash Player 10. It gives you major control over how the text is displayed (at the cost of being pretty complex.) Here's a good place to start: Using Text Layout Framework

Related

Is there anyway to add a icon in the Entry placeholder?

I can not use a Background Image because cannot fix the position of the start point.the placeholder text is centered.so it is not duplicated.
How to add an icon in the placeholder of an Entry beside using Grid or Layout. Just add it in the placeholder.
I want to make an Entry with placeholder containing an icon . Which is center in the Entry so that I can not use grid or layout to add a Image because this is not the best way.
I think I will have to make clicked event functions of the Image and the entry focus to hide the Image.
The expected result is like that:
Entry
The first way I can think of doing this:
If the icon you would like to use is a generic icon, FontAwesome is a fantastic fontkit that displays icons in the place of text. I have implemented it into Xamarin Forms many times. Here are some tutorials on how to do that:
https://www.wintellect.com/using-fontawesome5-xamarin-forms/
https://doumer.me/icons-with-font-awesome-5-xamarin-forms/
What you would do is set the FontFamily of the entry field to FontAwesome, and then add a textchanged event on text length > 0 change the fontfamily to your normal font, on text length = 0 (Place holder displayed) Change font family to FontAwesome.
The second way I can think of doing this:
Create a Xamarin Forms Custom Renderer for all of the platforms you are using. whereby you will on the native level alter how the Entry field functions to display an icon in its placeholder. To do this you will either need some native expierience on both platforms or some patience and learning about the native platforms.
If you need further help feel free to drop a comment :)

Material-UI change TextField color when input text is too long

I am new to Material UI and I am currently testing on TextField.
When the value is longer that the width of the field, you still can read the text with clicking on the field and drag to right.
I would like to ask if there is a way to change the font color (Or any other thing) if length of the string is longer than a certain value in order to indicate there are some texts left behind.
(Single line edit field is necessary since there are many fields required to show on screen)
Thank you very much!

Xpages combobox size bigger then inputText size

I have a table with inputTexts and comboBoxes within it. In edit mode is all working fine, but in read mode, the text within the comboBoxes seem to have padding, but they don't. I checked with Chrome and it seem that the combobox has, by default, another element inside it, a table which contains the text.
Question: How can I remove that table inside the combobox in order for the elements to align better, withouth having to put margin-left and margin-top to the combobox?
Use custom renderers (which is the most elegant way but also advanced).
http://openntf.org/XSnippets.nsf/snippet.xsp?id=remove-table-tag-for-listboxes-in-read-mode-for-all-instances-in-one-go
You can use the rendered property. Show comboBox only if document is in editmode
rendered="#{javascript:document1.isEditable()}"
and add a computed field which shows the value as plain text with the rendered property
rendered="#{javascript:!document1.isEditable()}"
As an alternative, you can use Brad Balassaitis' solution from his blog. He deletes nested tables onClientLoad.
Or, you work with css classes.

How can I read a spark TextArea implicit line breaks?

I have a TextArea where the user can enter text and also change the width and height of the TextArea. When resizing, the text is breaking where expected. I need to find where the TextArea skin added the implicit line breaks after resizing.
ENVIRONMENT
FlexBuilder 4.6
Flex SDK 4.6.0
Flash Player 11.1
EXAMPLE
This is just plain text that
breaks after the word "that".
Any ideas on how to find the position of the line break when the TextArea lineBreak property is toFit and the text has no CR or LF characters? In the example above, it would be position 28.
You can split up the text into line components and return their individual text lengths pretty easily, but you'll have to use some 'text layout framework' magic.
First access your TextArea's textFlow property (not the text property), which will return a TextFlow instance. This is a model for the text inside your TextArea.
This object has a flowComposer which takes care of the layout of the text and carries a lot of information with it.
Its type is IFlowComposer, but you'll have to cast it to a StandardFlowComposer in order to access the individual lines.
Now you have access to the lines property, which is a collection of TextFlowLine
Each of these lines has a textLength property.
So the following
var composer:StandardFlowComposer =
myTextArea.textFlow.flowComposer as StandardFlowComposer;
for each (var line:TextFlowLine in composer.lines)
trace(line.textLength)
would yield (with your example)
29
30

what property should i set to Fit the text in label

I want to display a big string in a Qlablel for this I simply have created a label in the Qt GUI editor.
Then set the string with the Wordwrap property to "ON".
Here text is not coming to the next line itself. Instead, it's crossing the view region.
However, if I give an "\n" it works well.
How do I put up the big string in a label to display in a visible region?
label->setWordWrap(true);
See the QLabel::setWordWrap(bool on) documentation.

Resources