************************************************** *-- Class: basegrid (grid.vcx) *-- ParentClass: grid *-- BaseClass: grid *-- Time Stamp: 07/30/02 10:37:01 AM * DEFINE CLASS basegrid AS grid FontName = "MS Sans Serif" FontSize = 8 DeleteMark = .F. Height = 200 ReadOnly = .T. RowHeight = 16 Width = 320 Name = "basegrid" PROCEDURE recordsource_assign LPARAMETERS vNewVal LOCAL lni, lnlast, lcalias, lcfield, lcsetfld,; lclist, lcfontname IF "5." $ OS() lcfontname = "Tahoma" ELSE lcfontname = "MS Sans Serif" ENDIF IF NOT 'GRID.VCX' $ SET('CLASSLIB') SET CLASSLIB TO GRID.VCX ADDITIVE ENDIF lcsetfld = "FIELDS" This.RecordSource = m.vNewVal WITH This .SetAll('FontName', lcfontname, 'Header') .SetAll('FontSize', 8, 'Header') .SetAll('FontBold', .T., 'Header') .SetAll('FontName', lcfontname, 'Column') .SetAll('FontSize', 8, 'Column') ENDWITH IF NOT EMPTY(m.vNewVal) lcalias = m.vNewVal + "." IF SET(lcsetfld) = 'OFF' OR SET(lcsetfld, 1) = 'ALL' lnlast = FCOUNT(JUSTSTEM(lcalias)) FOR lni = 1 TO lnlast lcfield = lcalias + FIELD(lni, JUSTSTEM(lcalias)) This.AddCheckBox(lcfield, lni) NEXT ELSE lclist = SET(lcsetfld, 1) lnlast = Words(lclist, ",") FOR lni = 1 TO lnlast lcfield = lcalias + WordNum(lclist, lni, ",") This.AddCheckBox(lcfield, lni) NEXT ENDIF ENDIF RELEASE CLASSLIB GRID.VCX ENDPROC *-- Adds the checkbox (removing the text box) as the current control PROCEDURE addcheckbox LPARAMETER tcField, tni LOCAL locol as Column IF VARTYPE(&tcField) = "L" locol = EVALUATE("This.Column" + TRANSFORM(tni)) locol.RemoveObject("Text1") locol.AddObject("GridCk1", "GridCk") loCol.Gridck1.Visible = .T. locol.Sparse = .F. ENDIF RETURN ENDPROC ENDDEFINE * *-- EndDefine: basegrid ************************************************** ************************************************** *-- Class: gridck (grid.vcx) *-- ParentClass: checkbox *-- BaseClass: checkbox *-- Time Stamp: 07/29/02 11:38:13 AM * DEFINE CLASS gridck AS checkbox Height = 17 Width = 18 AutoSize = .T. BackStyle = 0 Caption = "" Value = .F. Name = "gridck" ENDDEFINE * *-- EndDefine: gridck ************************************************** ************************************************** *-- Class: gridtxt (grid.vcx) *-- ParentClass: textbox *-- BaseClass: textbox *-- Time Stamp: 10/19/00 11:37:08 AM * DEFINE CLASS gridtxt AS textbox FontName = "MS Sans Serif" FontSize = 8 BorderStyle = 0 Height = 23 Margin = 0 Width = 100 Name = "gridtxt" ENDDEFINE * *-- EndDefine: gridtxt ************************************************** ************************************************** *-- Form: form1 (browfrm.scx) *-- ParentClass: form *-- BaseClass: form *-- Time Stamp: 09/07/01 11:22:14 AM * DEFINE CLASS form1 AS form Top = 0 Left = 0 Height = 254 Width = 380 DoCreate = .T. Caption = "Form1" FontName = "MS Sans Serif" FontSize = 8 Name = "Form1" ADD OBJECT basegrid1 AS basegrid WITH ; Height = 126, ; Left = 0, ; Top = 0, ; Width = 260, ; Name = "Basegrid1" PROCEDURE Resize WITH ThisForm.Basegrid1 .Height = This.Height .Width = This.Width ENDWITH ENDPROC PROCEDURE Init LOCAL lcdbf IF USED() lcdbf = DBF() This.Caption = LOWER(JUSTFNAME(lcdbf)) IF SPACE(1) $ lcdbf lcdbf = CHR(34) + lcdbf + CHR(34) ENDIF ThisForm.Basegrid1.RecordSource = ALIAS() ENDIF This.Resize This.Icon = _SCREEN.Icon ENDPROC ENDDEFINE * *-- EndDefine: form1 **************************************************This was orginally written prior to VFP 7.0, so I used foxtools rather than the functions that now exist in 7.0 to parse the fields returned by SET('FIELDS')