oForm=createobject('myForm') oForm.Show Read events oForm2=createobject('myForm2') oForm2.Show Read events Define class myForm as Form Procedure queryunload Clear events Endproc Procedure init Define popup mypop Define bar 1 of mypop prompt 'Color1' color RGB(0,0,0,192,192,192), RGB(0,0,0,0,255,255) Define bar 2 of mypop prompt 'Color2' color RGB(0,0,0,192,192,192), RGB(0,0,0,255,0,255) Define bar 3 of mypop prompt 'Color3' color RGB(0,0,0,192,192,192), RGB(0,0,0,255,255,0) Define bar 4 of mypop prompt '\DisabledColor4' color RGB(0,0,0,192,192,192), RGB(0,0,0,0,255,0) Define bar 5 of mypop prompt 'Color4' color RGB(0,0,0,192,192,192), RGB(0,0,0,0,255,0) This.Addobject('ColorCoded','ListBox') With this.ColorCoded .RowSourceType = 9 .Rowsource = 'mypop' .Visible = .t. Endwith Endproc Enddefine Define class myForm2 as Form DataSession = 2 Procedure queryunload Clear events Endproc Procedure load Create cursor test (v1 c(10),v2 i,v3 d, v4 l, bkcolor i) For ix=1 to 26 Insert into test values ; (replicate(chr(64+ix),10),ix,date()-ix, dow(date()-ix,1)=1,floor(rand()*0xFFFFFF)) Endfor Locate Endproc Procedure init This.Addobject('ColorCodedGrid','ColorCodedGrid') With this.ColorCodedGrid lnSelBkCol = .Columns(1).Controls(2).SelectedBackColor .SetAll('DynamicBackColor',; 'iif(this.nCurrec = recno(), '+str(lnSelBkCol)+', test.bkColor)', ; 'Column') .ColumnCount=4 .Visible = .t. Endwith Endproc Enddefine Define class ColorCodedGrid as Grid RecordMark = .F. DeleteMark = .F. HeaderHeight=0 ScrollBars=2 SplitBar=.F. GridLines=2 Highlightrow=.F. nCurrec=0 Procedure init For each oCol in this.Columns oCol.RemoveObject('Text1') oCol.Addobject('Text1','mytextbox') oCol.Text1.Visible = .t. oCol.Sparse=.F. Endfor Endproc Procedure when Set cursor off Endproc Procedure valid Set cursor on Endproc Procedure beforerowcolchange Lparameters nColIndex Thisform.lockscreen=.t. Endproc Procedure afterrowcolchange Lparameters nColIndex Thisform.lockscreen=.f. This.nCurrec=recno(this.recordsource) Endproc Enddefine Define class myTextbox as textbox BorderStyle=0 SpecialEffect=1 Margin=0 Procedure mousedown Lparameters p1,p2,p3,p4 This.setfocus() Endproc EnddefineCetin