Public oForm oForm = Createobject('sampleform') oForm.Show() Define Class SampleForm As Form Height=600 Width=400 Dimension aColors[16] Dimension aTitles[1] Dimension aCountries[1] Add Object myGrid As Grid With Height=600, Width=400, Anchor=15, RecordSource='employee', ColumnCount = 3,RowHeight=21*3 Procedure Load Set Multilocks On Use (_samples+'data\employee') CursorSetProp("Buffering",5,'Employee') Endproc Procedure myGrid.Init This.Columns(1).ControlSource='employee.Emp_id' This.Columns(2).ControlSource='employee.Country' With This.Columns(3) .AddObject('DayJobs', 'MyObject') .CurrentControl = 'DayJobs' .Width = 200 .Sparse = .F. .DynamicFontBold = '(thisform.SetMyObjectColor(employee.Country, employee.Title))' .DayJobs.Visible = .T. Endwith Endproc Procedure SetMyObjectColor(tcCountry, tcTitle) Local lnTitleColor, lnCountryColor lnTitleColor = This.aColors[ASCAN(this.aTitles, m.tcTitle, 1, -1, 1, 1+2+4+8)] lnCountryColor = This.aColors[ASCAN(this.aCountries, m.tcCountry, 1, -1, 1, 1+2+4+8)] With This.myGrid.Columns(3).DayJobs .txtTitle.BackColor = m.lnTitleColor .txtFirstName.BackColor = m.lnCountryColor .txtLastName.BackColor = m.lnCountryColor Endwith Return .T. Endproc Procedure Init Select Distinct Title From employee Into Array This.aTitles Select Distinct country From employee Into Array This.aCountries This.aColors[1] = 0x8080FF This.aColors[2] = 0x80FF80 This.aColors[3] = 0x80FFFF This.aColors[4] = 0xFF80FF This.aColors[5] = 0xFFFF80 This.aColors[6] = 0xFF4000 This.aColors[7] = 0xFF00FF This.aColors[8] = 0x00FF00 This.aColors[9] = 0x808000 This.aColors[10] = 0x0000FF This.aColors[11] = 0xFF0000 This.aColors[12] = 0x800080 This.aColors[13] = 0x800000 This.aColors[14] = 0x008000 This.aColors[15] = 0x000080 This.aColors[16] = 0xFFFFFF Endproc Enddefine Define Class MyObject As Container Width = 200 Add Object txtTitle As TextBox With Top= 2, Left=2, Width = 200, Margin=0, BorderStyle=0, ControlSource='employee.Title' Add Object txtFirstName As TextBox With Top=23, Left=2, Width = 200, Margin=0, BorderStyle=0, ControlSource='employee.First_Name' Add Object txtLastName As TextBox With Top=44, Left=2, Width = 200, Margin=0, BorderStyle=0, ControlSource='employee.Last_Name' Enddefine