[nycfoxsig] Re: Hey Jay... what's up with this? -- table driven grids

  • From: Jay Berardinelli <docman@xxxxxxxxxxxxx>
  • To: nycfoxsig@xxxxxxxxxxxxx
  • Date: Tue, 06 Nov 2007 00:01:08 -0500

i'm glad you're getting it.

any chance we can use the new discussion thread on the new website for stuff like this. i was waiting for you and Peter to sign off on it before announcing it to the group.
Jay

Lew wrote:
ok.. I see that addcolumn() is only good for the built in column class or the memberclass if specified... same result if you just assign a number to ColumnCount. AddObject (or NewObject()) is more flexible and updates ColumnCount, *and* the columns and controls collections ... so they are way more flexible.

------------------------------------------------------------------------
*From:* nycfoxsig-bounce@xxxxxxxxxxxxx [mailto:nycfoxsig-bounce@xxxxxxxxxxxxx] *On Behalf Of *Jay Berardinelli
*Sent:* Sunday, November 04, 2007 8:47 PM
*To:* nycfoxsig@xxxxxxxxxxxxx
*Subject:* [nycfoxsig] Re: Hey Jay... what's up with this? -- table driven grids

i dont use memberclass... that's another way to do it. with other issues that you need to work it.
you're making it harder than it needs to be.
jay


Lew wrote:
I'm using a memberclass in the grid def, so my custom col is loaded anyway...also with a custom header... getting a custom text (or whatever) is tricky.

------------------------------------------------------------------------
*From:* nycfoxsig-bounce@xxxxxxxxxxxxx [mailto:nycfoxsig-bounce@xxxxxxxxxxxxx] *On Behalf Of *Jay Berardinelli
*Sent:* Sunday, November 04, 2007 7:35 PM
*To:* nycfoxsig@xxxxxxxxxxxxx
*Subject:* [nycfoxsig] Re: Hey Jay... what's up with this? -- table driven grids

yup...  if you add a subclass of column it does.



Lew wrote:
so if you addobj()... the classs automatically adds it to the column collectoin & increments the columncount ?

------------------------------------------------------------------------
*From:* nycfoxsig-bounce@xxxxxxxxxxxxx [mailto:nycfoxsig-bounce@xxxxxxxxxxxxx] *On Behalf Of *Jay Berardinelli
*Sent:* Sunday, November 04, 2007 6:59 PM
*To:* nycfoxsig@xxxxxxxxxxxxx
*Subject:* [nycfoxsig] Re: Hey Jay... what's up with this? -- table driven grids

you can use addcolumn.
i choose to use addobject because i have a column class with when and valid events and keypress events, etc.
many ways to do this with the fox...


Lew wrote:
Got it, thanks. Somehow or other I didn't set the .RecordSource because I was afraid that the fox would start autoloading column objects. I'm using .AddColumn() rather than .AddObject().... Am I a missing something else?

------------------------------------------------------------------------
*From:* nycfoxsig-bounce@xxxxxxxxxxxxx [mailto:nycfoxsig-bounce@xxxxxxxxxxxxx] *On Behalf Of *Jay Berardinelli
*Sent:* Sunday, November 04, 2007 12:37 PM
*To:* nycfoxsig@xxxxxxxxxxxxx
*Subject:* [nycfoxsig] Re: Hey Jay... what's up with this? -- table driven grids

Lew,
I don't touch the bindcontrols property, its set to the default.

the table or cursor needs to be opened before you programmatically assign the objects to the grid.
i use this at the start of my class to setup the grid
grid1.RecordSource= alias1
grid1.ColumnCount=0    && insure that no columns
*i can also assign others if i want, or set the colors in the grid object.

i use a class: grid1.AddObject(ccol,'GRID_COL') to add a column to the grid, where ccol is the name of the column
*heres an abstract of code that i use to build each column
    With grid1.&ccol
            .header1.Caption= Alltrim(GridS.Heading)
            .Width = GridS.Width

If .edit_mode=0 And GridS.col_type<>'check' &&cant do this for check boxes
                *for readonly fields except checkboxes
.ControlSource = "' '+ALLTRIM("+Alltrim(GridS.cs)+")" *assigned the quote above as is -- is required for my concept to work. this also makes it readonly
            Else
                .ControlSource = Alltrim(GridS.cs)
            Endif
    endwith

hopefully that will get you started.



Lew wrote:
Hi Jay:
Started playing with table driven grids. Things went ok until I started with multiple use's for the same table, set filters, etc... until I discovered setting bindcontrols to .f. while loading the col definitions. When the entire form is good to go, setting bindcontrols .t. seems to work. Any idea what up with this? -Lew

Other related posts: