PUBLIC ocform1 ocform1=CREATEOBJECT("cform1") ocform1.Show RETURN DEFINE CLASS cform1 AS form Top = 0 Left = 0 Height = 289 Width = 375 DoCreate = .T. *-- Count of GenColor calls ncount = 0 Name = "Cform1" ADD OBJECT grid1 AS grid WITH ; Height = 234, ; Left = 5, ; RecordSource = "dyntest", ; Top = 9, ; Width = 366, ; Name = "Grid1" ADD OBJECT text1 AS textbox WITH ; ControlSource = "thisform.nCount", ; Height = 23, ; Left = 15, ; Top = 256, ; Width = 100, ; Name = "Text1" PROCEDURE gencolor lparameter nColor this.nCount = this.nCount + 1 this.Text1.Refresh() return nColor ENDPROC PROCEDURE Load create cursor dyntest ; (a0 i, a1 i, a2 i, a3 i, a4 i, a5 i, a6 i, a7 i, a8 i, a9 i,; b0 i, b1 i, b2 i, b3 i, b4 i, b5 i, b6 i, b7 i, b8 i, b9 i,; c0 i, c1 i, c2 i, c3 i, c4 i, c5 i, c6 i, c7 i, c8 i, c9 i,; d0 i, d1 i, d2 i, d3 i, d4 i, d5 i, d6 i, d7 i, d8 i, d9 i,; e0 i, e1 i, e2 i, e3 i, e4 i, e5 i, e6 i, e7 i, e8 i, e9 i ) append blank scatter to x for i = 1 to 20 if ( i > 1 ) append blank endif for j = 1 to 50 x[j] = rgb(int(rand()*255), int(rand()*255), int(rand()*255)) endfor gather from x endfor goto top ENDPROC PROCEDURE Init for each loCol in this.Grid1.Columns loCol.Sparse = .f. loCol.DynamicBackColor = "thisform.GenColor( " + loCol.ControlSource + " )" endfor this.Grid1.Refresh() ENDPROC ENDDEFINE