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.

Reply via email to