>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 > >Thanks. I'm doing it by adding the grid in the form's Init method (because I need to pass in the field list and other stuff). The grid came up, but it appears that something didn't work right. I don't get controls in the columns named "myHeader" and "myText", only the defaults. Here's the code I put in the grid subclass's Init:
* 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. ENDIFMy custom SetupGrid method sets the cSQL property. Hmm, just hit me that I should probably pass .F. or omit the params in DODEFAULT. I'll try that.