Cetin & Jess,
Further to my previous reply... I discovered that the erratic behaviour in the cell colouring came from using the grid.Column.Text.Value. It would apply the colour to the cell previously active; in a page up/down, whole columns got the colour based on the current cell's value.
Referencing the table's field value instead fixed the problem, however, both ways should have worked.
Thanks, Ashley
>>I'm trying to set the cells in a grid to different colours based on their value.
>>So far I'm getting erratic results where (apparently) random cells are changing color when scrolling a line or cell at a time, sometimes effecting the whole column or neighbouring cells. I've tried refreshing the grid with no effect.
>>I've tried the odd/even record example and that works fine, it just does not seem to to work properly at the grid.column.text.value level.
>>
>>Any suggestions?
>>
>>TIA
>Ashley,
>Dynamicback or forecolor also work with value level but setting the correct expression is sometimes tricky. Try the following example that changes backcolor in a buffered table based on value change (edited fields and newly appended recs have red backcolor).
>for ix = 1 to this.columncount
> with this.columns(ix)
> cField = substr(.controlsource,rat(".",.controlsource)+1)
> .DynamicBackColor = "iif(oldval(["+cField+"])#"+cField+" or recno()<0,"+;
> str(rgb(255,0,0))+","+str(this.backcolor)+")"
> endwith
>endfor
>Cetin