Clear all ON key label "F2" clear events USE (home()+"samples\data\customer") oForm = createobject("Form") oForm.Addobject("oTemp","MyGrid") WITH oForm.Otemp ENDWITH oForm.Otemp.visible = .t. oForm.show() READ events DEFINE CLASS MyForm AS Form PROCEDURE Click = MESSAGEBOX('MyForm has been clicked!') ENDPROC ENDDEFINE DEFINE class mygrid as grid PROCEDURE addcolumn LPARAMETERS nIndex, cAlias, cField NODEFAULT this.addobject("clm"+cField,"mycolumn", cAlias+"."+cField,nIndex) ENDPROC PROCEDURE init WITH this nOldColCount = .columncount FOR ix = 1 to fcount() .AddColumn(ix, alias(), field(ix)) ENDFOR FOR ix = nOldColCount to 1 step -1 .RemoveObject(.Columns(ix).name) ENDFOR ENDWITH ENDPROC ENDDEFINE DEFINE class mycolumn as column DynamicBackColor = "iif(recno()%2=0,rgb(192,192,192),rgb(255,0,0))" PROCEDURE init LPARAMETERS cControlSource, ncopycol this.controlsource = cControlSource this.width = this.parent.columns(ix).width this.removeobject("Header1") this.addobject("Header1","myHeader",this.parent.columns(ix).header1.caption) * this.header1.caption = this.parent.columns(ix).header1.caption ENDPROC PROCEDURE mousemove LPARAMETERS nButton, nShift, nXCoord, nYCoord WAIT window nowait "Focused on "+this.name ENDPROC ENDDEFINE DEFINE class myheader as header BackColor = rgb(255,255,255) ForeColor = rgb(0,0,255) PROCEDURE init LPARAMETERS tcCaption this.caption = tcCaption ENDPROC PROCEDURE click this.parent.columnorder = 1 ENDPROC ENDDEFINECetin