Formatting text within a field

Sarah Reichelt sarahr at genesearch.com.au
Tue Dec 7 18:34:43 EST 2004


> I have another question about fonts: is it possible to format the text 
> within a field without using HTML? I have only been able to make 
> uniform text in a field [i.e. all same size, style: bold, italisized, 
> underlined, and font face.]
>
Yes it is. Try things like:

set the textFont of line 3 of fld "Text" to "Verdana"
set the textStyle of char 3 to 7 of line 12 of fld "Text" to 
"bold,italic"
set the textSize of line 3 to 6 of fld "Text" to 14
set the foreColor of word 5 of line 2 of fld "Text" to "blue"

If you need to copy the text to another field, you will have to use the 
htmlText as that is the property that holds the formatting.
e.g.
put fld "Text" into fld "Another" will only copy the actual text.
set the htmlText of fld "Another" to the htmlText of fld "Text" will 
copy all the formatting.

This also allows a very quick method of removing all formatting:
put fld "Text" into fld "Text"

Cheers,
Sarah



More information about the use-livecode mailing list