Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Changing the class of existing objects
Message
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00179378
Message ID:
00179384
Views:
26
>I have a form that was created using FoxPro's base classes. I have since created my own library of classes and would like to change the class and parent class of the EditBox's, Command buttond etc in my existing form.
>
>Would replacing the class and parent class fields in the scx file work? Is there another way?
>
>Also, should I have based my set of classes on the standard FoxPro classes or the ones in the "My base classes" section of the componenet gallery in VFP 6?

To change the class your class is inherited from:

1) Make a backup copy of your VCX or SCX.
2) Open the VCX as a table: 'USE MyVCX.VCX ALIAS SCREEN'
or the SCX as a table: 'USE MySCX.SCX ALIAS SCREEN'
3) Then 'BROWSE LAST'.
4) Open windows for 'ObjName', 'Class' and 'ClassLoc' Fields (they are memos)
5) Scroll down the table until you find the class you want to change
in the 'ObjName' field.
6) The 'ClassLoc' field will refer to the VCX which holds the current class
inherited from (or blank if a Fox baseclass). Change this to the RELATIVE
path of the VCX Which holds the new class you want to inherit from.
7) The 'Class' field will hold the name of the class to inherit from (i.e.
'textbox'). Change this to the name of the new class to inherit from.
8) Repeat steps 5-7 for each class you want to change. (Try it on only one
to start!!!)
9) Close the table (MyVCX.VCX or MySCX.SCX)
10) Now open the VCX as a library just as you normally would. If you did every
thing correctly it will now be inherited from the new class. You can use
this technique to change from one type of baseclass to another. If you do
make sure that any methods and properties you rely on exist in the new class
or you will loose them!!!

Note: I used the 'ALIAS SCREEN' while opening the VCX so that the next time
BROWSE LAST will automatically open the memo windows for the fields I want to
work with. This will keep me from having to do STEP 4 every time. VCX and SCX files have the same structure so you can use the same alias for modifing both.

BE VERY CAREFULL DOING THIS!!! IT CAN MAKE YOUR VCX OR SCX UNUSABLE!!!
ALWAYS BACKUP FIRST!!!


As to your second question. It is a matter of personal judgement. If you are
going to use the FFC classes then yes you would want to.
Gary Paul
The Frank Gates Service Company
gpaul@frankgates.com
Previous
Reply
Map
View

Click here to load this message in the networking platform