Solved. it would seem that there IS a bug in the "view code" option in the class browser in that it generates code that Doesn't work as far as Grid headers are concerned. The class browser is incidentally where I took my sample code from in the absence of the help file) and that you have to create the column headers for the grid in somewhere like the init() of the form or as others have said the init() of the grid if you subclass it.
Happy now, but I'm sure I have had the "add object.." method working at some time.... but maybe not for grid headers ... and my mind is making things up. I feel better now that I know I'm not going loopy .... just forgetful! Thanks all... Dave -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Dave Crozier Sent: 11 April 2012 14:42 To: ProFox Email List Subject: RE: Brain fart moment ... Peter, Yes, that code was created from the class browser "view code" option. This is damned strange and I accessed the VFP on line help (Thanks John H) and the code syntax would seem to be correct... but it errors from a syntax error ... but WHY?? Very weird. Thanks to all for the input and if I find out why it errors I'll post back... unless someone beats me to it. Dave -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Peter Cushing Sent: 11 April 2012 14:19 To: [email protected] Subject: Re: Brain fart moment ... Hi Dave, Looked around for some code in the archives and found some you sent me late last year (see link below) that looks like it is generated by a builder and that comes up with the same syntax error on the add object line. Does it in VFP7 and 9, so don't think your VFP is screwed but also don't know why it errors. http://leafe.com/archives/msg/465560 Cheers, * Peter Cushing * IT development and support Signature Dave Crozier wrote: > Peter, > I know that works... I did the same i.e subclassing the grid. However I have > just generated a form visually with a grid having 3 columns and looked at the > generated code from the ClassBrowser and it does the "add object....." in > exactly the same way as I have .... and that code doesn't compile either so > is my VFP that is screwed? I don't think so but the syntax I have used I'm > sure is correct. > > Now it's bugging me. > > Dave > > -----Original Message----- > From: [email protected] [mailto:[email protected]] On > Behalf Of Peter Cushing > Sent: 11 April 2012 12:07 > To: [email protected] > Subject: Re: Brain fart moment ... > > Hi Dave, > > Got this to work: > > > ************** > * Start Code > * > PUBLIC oform1 > > oform1=NEWOBJECT("clsform") > oform1.Show > > RETURN > > > define class clsForm as Form > Datasession=2 > Top=12 > Left=12 > Height=332 > Width=790 > Caption = "This is my form" > Name="Form1" > > add object grdGrid1 as myGrid with ; > Left=36, ; > Top=24, ; > Name="grdGrid1", ; > Deletemark=.F., ; > TabIndex = 1, ; > ColumnCount = 3, ; > Column1.Name = "Column1", ; > Column2.Name = "Column2", ; > Column3.Name = "Column3" > > > > enddefine > > DEFINE CLASS mygrid AS GRID > ColumnCount = 3 > PROCEDURE Init > THIS.Column1.header1.caption = 'My header1' > this.Height = 332 > this.Width = 790 > ENDPROC > ENDDEFINE > > * > * End Code > ***************** > > Cheers, > > > * Peter Cushing * > IT development and support > > Signature > > > Dave Crozier wrote: > >> OK, I'm having a stressful day here but can anyone spot the obvious reason >> why the following code fails on the add "object Form1.grdGrid1" line with a >> syntax error. >> >> I'm out on site at the moment without the VFP help file and can't for the >> life of me see what is probably obvious. I don't normally create grids in >> 100% code but I need to at this time. >> >> I know I'm going to look a Bozo here but... >> >> Dave >> >> ************** >> * Start Code >> * >> PUBLIC oform1 >> >> oform1=NEWOBJECT("clsform") >> oform1.Show >> RETURN >> >> >> define class clsForm as Form >> Datasession=2 >> Top=12 >> Left=12 >> Height=332 >> Width=790 >> Caption = "This is my form" >> Name="Form1" >> >> add object grdGrid1 as Grid with ; >> Left=36, ; >> Top=24, ; >> Name="grdGrid1", ; >> Deletemark=.F., ; >> Columncount=3 >> >> add object Form1.grdGrid1.Column1.Header1 as Header with ; >> Caption="My Header 1", ; >> Name="Header1" >> * >> enddefine >> * >> * End Code >> ***************** >> >> [excessive quoting removed by server] _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://leafe.com/mailman/listinfo/profox OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/[email protected] ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

