Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Changing MemberClass, and hacking SCX
Message
From
09/06/2005 12:12:47
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01021666
Message ID:
01021834
Views:
24
I got it. After further experimenting, the only things you have to do is change the name of the columns (in the Properties field of the Grid record) to the names that VFP will generate.

For example, if your class is named myColumn, then you have to change "column1" to "myColumn1". The same for the headers (there is one header record for each header of each column), in case you have changed headerClass for the column class. You have to change too the header class, but not the header classLoc.

This will break some code if you reference columns(x).header1 for example, and means hacking all forms with grids on them (I always base controls on my classes).

One way to avoid breaking everything is to define the column and header class as follows:
define Class jColumn as Column
	headerClass = 'jHeader'
	headerClassLibrary = 'class_columns.prg'
	name = 'column'

	procedure init()
		return doDefault()
	endproc
endDefine

define Class jHeader as Header
	alignment = 2	&& middle-center
	name = 'header'
	
	procedure init()
		return doDefault()
	endproc
endDefine
What's important is to include the "name" property, and VFP will take it and add integers for form the final names for columns and headers. Using "column" and "header" as the standard name you will come up with the same names.
I made this change and I was able to open all of my forms without hacking them.

One gotcha: is you see the "class" property of the coliumns and headers, VFP says "column" instead of "jColumn", and "header" instead of "jHeader". The classLibrary property is OK, but not the class. I think this is a bug, but it does not affect, as all of the properties in the custom classes are inherited OK.

>>Hi all, I recently changed the memberClass and memberClassLibrary properties of my grid base class.
>>I new I was goin to break all the grids in forms, but I thought I could solve it by hacking the SCX files.
>>I tried to hack them but with bad results.
>>
>>Does someone know what do I have to tweak in the SCX so that the columns defined in my grids become columns of the class defined in myGrid.memberClass?
>>
>>Thanks is advance,
>>Javier.
>
>Try this but do a good backup first, keep in mind I not tested it:
>
>USE YourForm.SCX
>SET FILTER TO BaseClass == "Grid"
>LOCATE
>BROWSE
>
>*Go to Properties field and change MemeberClass row
>
>After that recompile the form
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform