Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sub-classing an SCX form...
Message
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00696958
Message ID:
00697623
Views:
23
>>Not exactly subclassing :), but you can easily convert VCX to SCX or vice versa by opening it as DBF and changing the value of UNIQUEID field in the first record from Screen to Class (or back).
>
>Nick , I've tried your interesting idea, but it doesn't work. A VCX is a class LIBRARY, whereas a form class is something IN a class library. Did I miss something?
>

Sure I forgot something :) and didn't tell the tiny little secrets. :)

Since SCX and VCX have the same structure, the deal is in the values of some fields/records and the existence of certain records.

Last time I did it was for VFP5 form class, converting it to the form.
In VFP 5 it is enough to change "Class" to "Screen" in UNIQUEID field in the first record and rename files (or COPY TO) SCX/SCT. Then you can open it as a form. Note, that it does not have "Dataenvironment" record but it seems not confusing VFP 5 Form Designer. You can just open Dataenvironment and add the necessary cursors and appropriate records will be added to the form's SCX.

To "convert" SCX to VCX you may copy/save your form with .VCX extension, then open that VCX file EXCLUSIVE and change "Screen" to "Class" in the UNIQUEID field in the first record AND type "Class" (without quotes) in RESERVED1 field in the "form" record. Then you delete the "dataenvironment" and "cursor" records and PACK the VCX file. However I don't see much use in such SCX->VCX operations since you can just use Save As Class.

But the conversion VCX->SCX might be useful.
I just retested with VFP 6 and found that VFP 6 Form Designer is not happy for the SCX not having Dataenvironment record. It brings up the Converter dialog and fails in conversion. So, you can just SCATTER MEMVAR MEMO the Dataenvironment record from any SCX then INSERT BLANK BEFORE the "form" record and GATHER MEMVAR MEMO. You should also remove "Class" word from RESERVED1 field in "form" record.

In all case you need to make sure that "form" record RESERVED2 field still keeps the correct number of controls on the form (form with no controls has 1 in it), as sometimes it disappears during the manipulations.

VCX->SCX "conversion" should be performed on VCX wich contains only the form class, to avoid extra work.
Nick Neklioudov
Universal Thread Consultant
3 times Microsoft MVP - Visual FoxPro

"I have not failed. I've just found 10,000 ways that don't work." - Thomas Edison
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform