>Below is a snippet of code that we use with grids.
>
>In the grid's AfterRowColChange() event:
>
>
>lnRecNo = RECNO()
>
>cExpr = "IIF(RECNO()=" + STR(lnRecNo) + ",RGB(0,0,128), IIF(" + STR(MOD(RECNO()
> ,2))+ "=0 AND" + STR(RECNO()) + "!=" + STR(lnRecNo)+ ",
> RGB(255,255,255),RGB(255,255,255)))"
>
>THIS.SetAll("DynamicBackColor", cExpr, "Column")
>
>cExpr = "IIF(RECNO()=" + STR(lnRecNo) + ",RGB(255,255,255),.F.)"
>
>THIS.SetAll("DynamicForeColor", cExpr, "Column")
>
>THIS.Refresh()
>
>GO lnRecNo
>
>THISFORM.Refresh()
>
>
>
>
>I hope this helps.
>
>BRIAN
Thanks Brian,
After seeing yours I realized my reply was faulty and corrected code also needs to keep a variable (no speed difference as I could test). Reducted your code a little bit to remove var necessity :
THIS.SetAll("DynamicBackColor", ;
"IIF(RECNO()="+str(recno()) + ;
",RGB(0,0,128), str(this.backcolor))", "Column")
THIS.SetAll("DynamicForeColor", ;
"IIF(RECNO()="+str(recno()) +",RGB(255,255,255),str(this.forecolor))", "Column")
this.refresh
But of course if a field value (or something like recno()%2) could be used it would be easier to have this just in "init" and call "this.refresh" here.
Cetin