How to add subscript/superscript to buttons label in flex? - apache-flex

I need to add subscript or superscript and normal text to buttons label. But as far as I understand button's label property is simple label, if it was RichText it would be easy.
I need subscript/superscript + normal text. Also I can't use 2 labels in skin class, I can only have 1 label or 1 RichText in skin class because as far as I understand labelDisplay works only for one label in skin class. Plus my button isn't constant.
So guys any ideas on how to get that done for button?

Here is the solution I found:
Download & install GG Subscript & GG Superscript TrueType fonts. You will need to restart Flash software after installed fonts.
Create a text field with Arial font embeded. Set the HTML property to true.
Create a dynamic text field with GG Subscript font embeded.
Create a dynamic text field with GG Superscript font embeded.
Use htmltext to set text to subscript or superscript like below:
my_txt.text = "Adobe<font face=\"GG Superscript\">TM</font>"
This is old solution for text fields. mx:Label supports htmltext, it may work. I think.

Related

How to paste the text with the same property in Actionscript 3?

I want to paste the text with the same height,width,color etc (i.e same as the time of copying the text).
I am using a textArea where i am adding text and also changing the color,font,size of the text by using style but if i am coping the text from textArea and pasting them then i am getting the text with default font style (Only changing heights are coming).
I have attached the image where you can see the difference
So anybody have an idea how to solve this problem ?
Maybe you can use a TextFlow and TextConverter with the methods export and importToFlow to use and TextConverter.TEXT_FIELD_HTML_FORMAT to get the format with the style attributes

display non-editable text in JavaFX with different CSS styles

Some text display in resizable AnchorPane. It may be Label or Text (not editable). In text may be bold (fat) words, for example. How to implement it? Text in Label or Text may be only in one style. When I link bold word with other text as two different Labels, I have problem with text wrapping (.setWrap(true)).
I found answer) TextFlow use for this.
https://docs.oracle.com/javase/8/javafx/user-interface-tutorial/text-settings.htm#CHDEEAFG

QLineEdit and Changing font for the “PlaceHolder” text

Is there a stylesheet tag I can use to change the font/font size of the placeholder text (and just that, leave the normal edit text as is) in QLineEdit?
The placeholder is shown only if text() is empty. Connect textChanged to your slot and set appropriate font using setFont. If text() is empty, set placeholder font, instead set normal font.

In flex how can someone add both bold and border?

I am trying to make a text area in flex 4.5. The problem is i need some part of it as bold not all. Also i need border.
A simple code is
<s:TextArea text="Text here1 Text here2">
By default s:TextArea contain border but I cant bold only one part of text that is "text here1"
If I try to use mx:TextArea Then I cant add border to it.
Please if anyone can help over how to add border along with if i can make only a part of text as bold or of different color etc.
Why can't you add a border to mxTextArea? There are a couple of ways:
specify borderStyle css property;
write a skin class, which draws a border and background you need, and assign it to borderSkin css property;
draw a 3x3 graphic skin and assign it to borderSkin css property.
Place a border container around the control
Use the textFlow property instead of the text property and you will be able to use rich text (bold, italics and so on).
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flashx/textLayout/elements/TextFlow.html

Changing Spark TextArea text color dynamically over a range of characters

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

Resources