>Hello,
>
>I created (visually) a grid class that uses a MemberClassLibrary and MemberClass. If in the designer, I set the grid's columncount to >0, I see the columns (and headers) that I specify in my prg code. I know this is correct because I can see the column styles and inherited code from my column class as defined in the prg.
>
>When I open a form and drop an instance of my grid class on it, set the column count to > 0, again things look fine. I know that the columns and headers are from my prg.
>
>The problem is that when I save this form then open it again in the IDE or run the form, the grid is using the default VFP settings. i.e. it is not respecting the fact that I have a MemberClass specified!
>
>Anyone else seen this behavior and found a solution?
I've also found memberclass to be unusable for prg based columns.
My columns accept four more parameters at init - the header caption, controlsource, and the class and classlib for the current control (the default textbox is never used - it defaults to my grdText class and also my header class).
The solution is a builder which creates the proper set of commands for grid's .init - the generated code looks like this:
Local lcAlias
lcAlias=Alias()
This.RecordSource=lcAlias
This.ColumnCount=0
This.Newobject("oColSifra","gcol","dcgrids.prg","","šifra", Forceext(lcAlias, "sifra"))
With This.oColSifra
.Sparse = .F.
.Width = Iif(.Width=75, 66, .Width)
With .hdr1
.Caption = [šifra]
Endwith
With .grdText
.BackColor = 16777215
.BorderStyle = 0
.ForeColor = 0
.Margin = 0
Endwith
Endwith
This.Newobject("oColNaziv1","gcol","dcgrids.prg","","naziv osnovnog sredstva", Forceext(lcAlias, "naziv1"))
With This.oColNaziv1
... etc etc
I have a metadata table where I keep each column's parameters, so at design time I have a two-way communication between the builder and the grid-in-design (i.e. whatever I do to the grid visually gets copied into the metatable, and whatever I edit there gets set as a property of the corresponding column - there are buttons for that). The final step is the creation of this init code, and setting the .columncount to zero. Then it works.