DynamicBackColor
A customer asked about how to change the colors in a grid dynamically. The code below changes the 3rd column’s backcolor if the row is selected. You can change the code to be based on a value in the row too.
PUBLIC ox
USE (SET("Resource",1)) AGAIN
ox=CREATEOBJECT("form")
ox.addobject("gr","grid")
ox.width=500
ox.gr.width=500
ox.gr.visible=1
ox.visible=1
ox.gr.column1.DynamicBackColor="iif(MOD(RECNO(),2)=0,RGB(255,0,0),RGB(255,255,255))"
ox.gr.column2.text1.SelectedBackColor=RGB(255,0,0)
ox.gr.column3.DynamicBackColor="iif(ox.gr.ActiveRow=RECNO(),RGB(255,0,0),RGB(255,255,255))"