Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Grid class with memberclass not working
Message
From
31/08/2006 19:00:28
Mike Sue-Ping
Cambridge, Ontario, Canada
 
 
To
31/08/2006 18:20:16
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01150228
Message ID:
01150263
Views:
34
Hi Dragan,

Your builder sounds very impressive indeed. Two way! Gotta like that. Any chance you'd be willing to share your builder?

Too bad prg based classes don't work as advertized (at least for the two of us). The thing that I've discovered is that if I add the grid to my form at runtime using code in the form's init method, it works fine!

I just wish it would behave correctly at design where I tend to cope better doing things visually.

Thanks for confirming that there is something strange going on with this stuff and that I'm not the only one having these issues.

Regards,
Mike



>>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:
>
>
*-- generated by BLDC7.OVM.WRITEINIT 06.08.2006 11:47:13
>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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform