>>Public oForm >>oForm = Createobject('sampleForm') >>oForm.Show() >> >>Define Class sampleform As Form >> Height=600 >> Width = 800 >> Add Object myButton As CommandButton With Caption="Create Grid" >> Add Object myContainer As Container With Top=30,Height=770,Width=800, Anchor=15 >> >> Procedure myButton.Click >> Thisform.myContainer.Newobject("myLocator","locatorgrid", "d:\foxyclasses\classes\grids.vcx","",; >> "* from (_samples+'data\customer')") >> With Thisform.myContainer.myLocator >> .Height = Thisform.myContainer.Height >> .Width = Thisform.myContainer.Width >> .Anchor = 15 >> .Visible = .T. >> Endwith >> Endproc >>Enddefine >> >>>
>* Modified 9-March-2017 by TEG >* Changing parameters, so we can build grid on the fly. >LPARAMETERS tcFieldList, tcTable >*!* Lparameters cSQL, cOrgSource >IF PCOUNT() < 2 > DO Error WITH "Cannot set up picklist without field list and table name" > RETURN .F. >ELSE > This.plFields = m.tcFieldList > This.cMainTable = m.tcTable >ENDIF > >This.oFieldList = NEWOBJECT("colBase","picsbase.vcx") >IF This.SetupGrid() > > DODEFAULT('', '') > This.FormatGrid() > >ELSE > RETURN .F. >ENDIF >>
with yourLocatorGrid .cSQL = "fieldList from ..." .lKeepFormat = .T. && If you have preset columns that you want the format preserved - might be already set to true .Init() && then you need to call init endwith