Field text styles

Jeanne A. E. DeVoto jeanne at runrev.com
Mon Feb 10 11:42:01 EST 2003


At 8:07 AM -0800 2/10/03, Graham Samuel wrote:
>I realise this is a dumb question, but if I create a field and set
>its text via the Development Environment to say (18 point bold, red,
>centered, 3D Box), when I actually put a value in it via say
>
>  put format("%05.2f",gSomeValue) into fld "myCoolDisplay"
>
>all the formatting is lost, and I get the font and styles which the
>field had when it was created.
>
>Do I have to reset these styles every time I put a value in the
>field, or is there a better way?

There are two ways:

1) Set the font information of the field itself, rather than its text.
(This is the best way if all the text in the field will always be 18-point
bold red.) Select the field, then choose your font choices from the Text
menu (or use the Text palette).

2) Instead of using put, set the htmlText of the field, so you can include
style information. (This is a good way if you only want some of the text to
be 18-point bold red.) Here's an example that sets line 2 of the field:

  set the htmlText of field "myCoolDisplay" to \
     the htmlText of line 1 of field "myCoolDisplay" \
     & "<p><font size=18 color=red><b>" \
     & format("%05.2f",gSomeValue) \
     & "</b></font></p>" \
     & the htmlText of line 3 to -1 of field "myCoolDisplay"

--
Jeanne A. E. DeVoto ~ jeanne at runrev.com
Runtime Revolution Limited - The Solution for Software Development
http://www.runrev.com/





More information about the use-livecode mailing list