Public oForm oForm = Createobject('myForm') oForm.Show Define Class myForm As Form DataSession=2 Height = 450 Add Object myGrid As Grid With Height = 450 Procedure Load Create Cursor manifest (Status c(1), myField i) For ix=1 To 20 Insert Into manifest Values (Chr(Asc('A')+Int(Rand()*5)),m.ix) Endfor Locate Endproc Procedure GimmeColour Lparameters tcValue Do Case Case m.tcValue = 'A' Return 0xFF0000 Case m.tcValue = 'B' Return 0x00FF00 Case m.tcValue = 'C' Return 0x0000FF Otherwise Return 0xFFFFFF Endcase Endproc Procedure Init This.myGrid.SetAll('DynamicBackColor','(thisform.GimmeColour(manifest.status))') Endproc EnddefineCetin
>>* Anywhere you want to set dynamic coloring - ie: form init >>thisform.myGrid.Setall('DynamicBackColor','(thisform.GimmeColor(manifest.status))') >> >>*Form custom GimmeColor >>lparameters tcValue >>do case >>case m.tcValue = 'A' >> return 0xFF0000 >>case m.tcValue = 'B' >> return 0x00FF00 >>case m.tcValue = 'C' >> return 0x0000FF >>otherwise >> return 0xFFFFFF >>endcaseCetin