Formatting columns across a list item
ambassador at fourthworld.com
Fri Feb 25 18:40:58 EST 2005
> I'm trying to use Revolution to build a program to track stock tickers. The
> wrinkle to this is that I'd like the movement in a stock to be red or green
> according to whether it was negative or positive.
> I've successfully built a static version that allows the user to enter up to
> 10 items, and as the fields are all labels I can format them as necessary.
> This is fine as far as it goes, but is a problem if the user wants to track
> more than 10 stocks.
> My next thought was to use a scrollable list, which would allow as many
> stocks as the user likes. However, with the standard Revolution lists it
> appears that they can only have a single text colour across all the columns
> for a given item. I think I must be missing something here, because I'm
> presuming that there is a way to do this in Revolution?
> The idea is to have:
> Stock name Price Change
> Where the stock name and price would be black text, and the change would
> vary according to the direction the stock is going in.
You can use htmlText to assign colors, either by mnemonic name or by
numeric values -- assuming your list is tab-delimited for display in the
columnar list you could do something like this (off the cuff, but should
on DisplayList pList
put empty into tHtmlText
set the itemdel to tab
repeat for each line tLine in pList
get item 3 of tLine
if it > 0 then put tLine&"<br>" after tHtmlText
put item 1 to 2 of tLine &tab& \
"<font color=""e&"red""e&">"& item 3 of tLine \
&"<br>" after tHtmlText
put tHtmlText into fld "Display"
Fourth World Media Corporation
Ambassador at FourthWorld.com http://www.FourthWorld.com
More information about the Use-livecode