* * GridCusClass.prg - custom classes for headers and columns define class cusHeader as header name = 'cusHeader' proc Click if this.Parent.lReSized && column this.Parent.lReSized = .f. else * Tell the grid this header was clicked = this.Parent.Parent.HeaderClick(This) && Grid endif endproc enddefine define class cusColumn as column lresized = .f. name = 'cusColumn' proc Resize * Tell the header this column was resized this.lReSized = .t. endproc enddefineBuilder code looks like the following :
set procedure to GridCusClass.prg additive * other initalization not shown * * clear grid - delete all existing columns for nCol = 1 to oGrid.ColumnCount oGrid.DeleteColumn() endfor ** set grid properties * not shown .. * * get the DE = aselobj(aAns,2) oDE = aAns[1] oGrid.RecordSource = "" if oGrid.RecordSourceType # 1 oGrid.RecordSourceType = 1 && alias endif ** add columns * * change columns to cusColumn local cColumn,nFieldNo,cCusControl,oControl,nPos,cClassLib for nCol = 1 to nNoCols with oGrid cColumn = "Column" + alltrim(str(nCol)) .AddObject(cColumn,"cusColumn") && at this point I get the error endwith endfor oGrid.RecordSource = oDE.Cursor1.Alias