Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Can I create classes in a vcx programatically?
Message
From
20/12/2006 16:51:01
Bill Drew
Independent Consultant
Chicago, Illinois, United States
 
 
To
20/12/2006 16:17:56
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
01179343
Message ID:
01179370
Views:
14
>>Now I'm wondering what is the best suggestion for accessing the code at runtime. I may not be able to get the code included in the exe and the application doesn't use a container (no stored procedures). It seems that there are 6 options. What are the pros and cons?
>>
>>1. Set procedure to the fxp. Nested cases.
>>2. Set procedure to the fxp. Many Procs within the fxp.
>>3. Create a prg-based class with many methods.
>>4. Create a vcx with many classes? (Having trouble with this because when I run the following code, the class is not recognized when I try to instantiate it.
>>
>>(xxxproc is the foxpro code
>>propstring is a list of properties)
>>
>>thisclass = "xyz"
>>CREATE CLASS &thisclass OF carcalc as "Custom"
>>USE carcalc.vcx
>>LOCATE for objname = thisclass AND baseclass ="custom"
>>REPLACE methods with xxxproc,PROPERTIES WITH PROPSTRING,RESERVED1 WITH "Class",Reserved1 WITH "1"
>
>Haven't tried this. Maybe you also need
>
USE
>compile classlib carcalc
>That would create the content in the objcode field.
>
>>5. Execscript on memo fields.
>>6. Put compiled code in memo fields,write to file, and execute.
>
>You can even put source code into memo fields, reversibly encrypted if you want, copy out into a .prg, compile and run. Which isn't really too different from (5). Also the .prg in a xml file would be an option, if distribution of the file is a concern.
>
>>The VCX seems like a good place to put the code. I would probably eliminate the readable code and ship only the compiled code. I just can't get the right method to make it.
>
>The trouble with shipping a vcx is that it's actually two files - but then you can also ship that as a xml, and have a xmltocursor() in the app, which would then copy to your.vcx and create object(s) from it.
>
>Frankly, any of these would work as methods of transport; it's more the matter of what's easier for you in development, i.e. which is easier to maintain.

Your suggestion helped. I made a sample class by hand and compared it to the one that I had generated and found that I also needed to fill Reserved3 with a list of properties and methods and I had to add a line to the Properties field for "Name=" the name of the class.

Really appreciate your attention!
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform