Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How can I create a new VCX of subclasses programatically
Message
From
08/10/1998 11:34:58
 
 
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00142974
Message ID:
00145070
Views:
43
>>
>>Hi Ken!
>>
>> I've tried this method and it does work. I would like to be able to do this without the Class Designer appearing, though. All I'm trying to do is create a set of empty sub-classes of my base classes so the end-user can modify the behavior of my classes with out having the source-code. Know of any tricks, etc., that I could try? I do have it functional with the CD coming up, and keyboarding the commands to exit, but it's kind of tacky. But it is only an in-house utility to create the empty class libs for distribution.
>>
>>Thanks for any info!
>
>
>The only way, without creating the VCX records manually, is to create an instance of your classes, then execute o.saveasclass(). To avoid the init issue, the only way is to have a parameter in all the Init methods and check the 1st param to be .NULL., and return aborting the rest of the Init code if NULL is passed. Then you could do a NEWOBJECT(,,"",.NULL.) to instantate the object (VFP6 only, use SET CLASSLIB/CREATEOBJECT for VFP3/5). You can add properties using object.AddProperty (in VFP6 only) and when you .saveasclass (or simply use .AddProperty in design mode), the properties will be added/changed in the class. You can't add methods programmatically except to be in the design mode, then use the KEYBOARD macro function and use the Add Method... dialog (which is a marco UI solution).

OK, Ken. Thanks for the information.

One other question on sub-classing:
If you have a sub-class that modifies a property from the default value of the baseclass, and then later that property is removed from the baseclass, that property no longer exists in the sub-class. You don't get any error or any indication that the property no longer exists in the base class, until you try to reference it in code for your sub-class. I would have thought that the sub-class property would have just become a new property belonging only to the sub-class. Is this correct functionality?

Heard anything new from Steven Wright lately? :)
Fred
Microsoft Visual FoxPro MVP

foxcentral.net
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform