Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Objects vs. Subclasses vs. classes 2

Status
Not open for further replies.

vfpguy

Programmer
May 15, 2001
4
US
I've learned OOP in Java, and am trying to learn it in VFP as well. I'm a bit confused as to how EXACTLY to have, say, a form class, then subclass that, and then how to create an object from that subclass (which I can then edit as I wish through the form designer).

Can you help?

Thanks a lot!

 
Menu -> File -> New... -> Class -> New File
Class Name: my_form
Based On: Form
Store In: My_classes.vcx

This will create your subclass of the VFP form class that you can now modify and save in the Class Designer.

Menu -> Tools -> Options... -> Forms (tab)
In Template classes, check Form, and pick my_form in my_classes.vcx. Click OK (or Set as default if you want to keep it beyond this VFP session).

Menu -> File -> New... -> Form -> New File

This will create a new form based on your form subclass, that you can now modify and save in the Form Designer.


Rick
 
Inessence, classes are stored in classlibraries, which usually are .VCX files in FoxPro.

You can also use code classes in FoxPro, but commonly used is the visual class. In runtime they are the same when they are created as objects.

If you start a project, it is most easy to use the project manager in which you can seee your class libraries and classes represented in the treeview.

This makes it easier to 'see' your classes and add new classes.

HTH,
Weedz (Wietze Veld)
My private project:And especially for VFP rookies:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top