local cConName,nSeekField,cClass,cClassLibrary,nTabIndex,nHeight local nLeft,nWidth,nTop,lcFontStyle,nAverCharWidth,nCols local oColumn,oControl,oGrid,lTallControl nSeekField = iif(this.lSeekCol,1,0) && 0 if seek field not used oGrid = eval("this.grdTableList") cClass = oGrid.Class cClassLibrary = justfname(oGrid.ClassLibrary) nTabIndex = oGrid.TabIndex nHeight = oGrid.Height nLeft = oGrid.Left nWidth = oGrid.Width nTop = oGrid.Top lcFontStyle = util.FontStyle(oGrid) && function in zUtil nAverCharWidth = fontmetric(6,oGrid.FontName,; oGrid.FontSize,lcFontStyle) nCols = alen(this.aGridFields,1) ** set grid properties oGrid.ColumnCount = nCols + nSeekField oGrid.TabIndex = nTabIndex oGrid.Height = nHeight oGrid.Left = nLeft oGrid.Width = nWidth oGrid.Top = nTop oGrid.RecordSource = thisform.PrimaryTable select (thisform.PrimaryTable) oGrid.ReadOnly = .f. oGrid.RecordSourceType = 1 set classlib to aGrdCtrl additive ** setup a seek column if required if this.lSeekCol oGrid.Column1.Name = "NdxColumn" oGrid.NdxColumn.BackColor = RGB(255,255,128) oGrid.NdxColumn.Header1.Caption = this.cOrderCaption oGrid.NdxColumn.ControlSource = alltrim(this.cOrderExp) oGrid.NdxColumn.AddObject("InGrid1","ingrid") oGrid.NdxColumn.InGrid1.Visible = .t. oGrid.NdxColumn.CurrentControl = "InGrid1" oGrid.NdxColumn.RemoveObject("Text1") * oGrid.Partition = 1 endif ** add columns for lnColNo = 1+nSeekField to nCols+nSeekField nFieldNo = lnColNo - nSeekField oColumn = eval("oGrid.Column" + alltrim(str(lnColNo))) oColumn.Header1.Caption = this.aGridFields(nFieldNo,this.cFieldCaptionCol) ** see if there is a custom control if not empty(this.aGridFields[nFieldNo,this.cDefaultControlCol]) && have a different control ** is the custom control from a different class library? nPos = at(".",this.aGridFields[nFieldNo,this.cDefaultControlCol]) if nPos > 0 ** from a different classlib cClassLib = left(this.aGridFields[nFieldNo,this.cDefaultControlCol],nPos-1) cClass = substr(this.aGridFields[nFieldNo,this.cDefaultControlCol],nPos+1) else ** from agridctrl cClassLib = "agrdctrl" cClass = this.aGridFields[nFieldNo,this.cDefaultControlCol] endif if not (upper(cClassLib)$set("classlib")) set classlib to (cClassLib) additive endif ** add the control with the same name as the class cConName = cClass+"9" oColumn.AddObject(cConName,cClass) oColumn.RemoveObject("Text1") oControl = eval("oColumn." + cConName) if inlist(lower(oControl.BaseClass),"combobox") oGrid.RowHeight = 21 endif oControl.Visible = .t. oColumn.Sparse = .t. oColumn.CurrentControl = (cConName) endif oColumn.ControlSource = ; lower(alltrim(this.aGridFields[nFieldNo,; this.cFieldNameCol])) oColumn.Bound = .t. oColumn.Width = this.aGridFields(nFieldNo,this.cFieldWidthCol) *; nAverCharWidth oColumn.ReadOnly = this.aGridFields(nFieldNo,this.lFieldReadOnly) *!* oColumn.Text1.ReadOnly = .f. endfor oGrid.Visible = .t. oGrid.Refresh[] return