Can't set font color of htmltext in a list field

Wilhelm Sanke sanke at hrz.uni-kassel.de
Fri Apr 8 12:29:44 EDT 2005


On Friday, Fri Apr 8, Ana Nelson ananelson at mac.com wrote:

> I have text such as the following which I put into the htmltext of a
> list field:
>
> <p><b>Mary Bloggs</b></p>
> <p>Joe Bloggs></p>
>
> This works fine, but I can't seem to change the color of the text.
>
> I have tried:
>
> <p><font  color="#FF0000">John Doe</font></p>
>
> and several variations, none of which seem to produce any result. The
> "John Doe" is displayed, and if I make the line bold or italic that
> shows up correctly, but color (or any other font attribute) doesn't
> work. When I paste the lines of text into Dreamweaver they show the
> correct color.
>
> I want to be able to set the colour of individual lines of text, not
> the entire block of text.



Mary,

Your code is almost O.K., there is only one Space too many between 
"<font" and "color=". Remove the extra Space and it should work.

One other simple way to colorize a line would be something like this:

"set the textcolor of  line 2 of fld "ListField" to green".

If you search for a specific text line that should be colorized such a 
script would work (assuming you have a line "Three" in the list field):

"on mouseUp
  set the wholematches to true
  put lineoffset("Three", fld "Listfield") into tLine
  put the htmltext of fld "ListField"  into tInterim
  if tInterim is not empty then
    replace line tLine of tInterim with "<FONT color=#FF0000>"&line 
tLine of tInterim&"</FONT>" in tInterim
    set the htmltext of fld "ListField" to tInterim
  end if
end mouseUp"

or of course without resorting to HTMLText:

"on mouseUp
  set the wholematches to true
  put lineoffset("Three", fld "Listfield") into tLine
  set the textcolor of line tLine of fld "ListField" to green
 end mouseUp"



Regards,

Wilhelm Sanke
<http://www.sanke.org/MetaMedia>



More information about the use-livecode mailing list