Colorizing List Fields

Jim Ault JimAultWins at yahoo.com
Sat Jun 23 01:55:44 EDT 2007


On 6/21/07 6:15 PM, "Sarah Reichelt" <sarah.reichelt at gmail.com> wrote:

> While either of these approaches will work, the html version is much
> faster if you have to color a lot of lines because you can work in a
> variable instead of directly in a field.
> 
> I have a printout generation routine where every 2nd line changes
> color and there are about 6000 lines. Using "set the textColor" took
> several minutes, but building the html to change colors happens almost
> instantly. 
So how do you set the backgroundColor of the line using html?
This will come in handy on my next project.

Jim Ault
Las Vegas


On 6/21/07 6:15 PM, "Sarah Reichelt" <sarah.reichelt at gmail.com> wrote:

>>> Is it possible to use either htmlText or rtfText to color the lines
>>> of a list?  I have a list field where I'd like to have each line
>>> colored depending on the type of record it's displaying.  If I can't
>>> set the font or background color using htmlText, what exactly CAN I
>>> use htmlText for?
>> 
>> You can set either or both... and you don't need to use htmlText or
>> rtfText if you don't want to - you can set the 'textColor' or
>> 'backgroundColor' property of individual lines from script:
>> 
>>   set the textColor of line 2 of field "MyListField" to red
>> 
>> But if you'd rather use HTML or RTF, be my guest:
>> 
>>   put "<font color=" & quote & "red" & quote & "> & \
>>     line 2 of field "MyListField" & "</font>" into tHTML
>>   set the htmlText of line 2 of field "MyListField" to tHTML
> 
> While either of these approaches will work, the html version is much
> faster if you have to color a lot of lines because you can work in a
> variable instead of directly in a field.
> 
> I have a printout generation routine where every 2nd line changes
> color and there are about 6000 lines. Using "set the textColor" took
> several minutes, but building the html to change colors happens almost
> instantly.
> 





More information about the use-livecode mailing list