Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Grid class with memberclass not working
Message
From
31/08/2006 18:20:16
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
31/08/2006 17:12:25
Mike Sue-Ping
Cambridge, Ontario, Canada
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01150228
Message ID:
01150254
Views:
31
>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.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform