How You Use the VPM Enterprise Classes

The VPM Enterprise classes are the blueprints for the objects that find their way into your VPM Enterprise applications.

With non-visual classes like the VPME application class, you may never be aware that the class exists unless you need to modify it or use its properties and methods. With visual classes like the VPME form classes, you will learn the purpose of each class and when it is appropriate to use a particular form class.

Many VPME users will create complex VPM Enterprise applications without ever needing to modify any of the VPME classes. Other users will recognize that the VPME classes canít provide all the functionality that they need and will modify or subclass the VPME classes as needed. We fully expect VPME users to modify and subclass the VPME classes as needed. The sections below tell you some things you need to know when you need to modify and subclass the VPME classes.

How the VPM-Level Classes Inherit

Before you begin modifying the VPM, DEV or PRO classes, you need to understand how inheritance works among the VPM, DEV and PRO classes. Because Visual FoxPro doesnít support multiple-inheritance, the inheritance among the VPM, DEV and PRO classes is different than you may expect. You need to understand how the VPM, DEV and PRO classes inherit because you need to know how the changes you make to a class affect other classes.

Weíll use the VPMFORMS, DEVFORMS and PROFORMS class libraries to illustrate inheritance. The Visual FoxPro Class Browser is shown below with the VPMFORMS class library open. The VPMFORMS class library contains VPM Enterprise form and toolbar classes.

The Class Browser shows the classes in VPMFORMS in a hierarchy that illustrates inheritance among the classes in that library. The topmost form class in VPMFORMS is Form_, which is the VPME base form class. All the other VPME form classes are subclasses of the Form_ class. That means that if you change the Form_ class, the other form classes inherit your change.

When you start creating forms in VPM Enterprise, you will find that the Form_Toolbar class is a very useful form class. The Form_Toolbar class in VPMFORMS is a subclass of the Form_ classes and in turn has several subclasses of its own. The Form_Toolbarís subclasses inherit from it at the VPM-level.

The form classes in VPMFORMS inherit from higher-level classes in VPMFORMS in a hierarchy as you would expect. So, if you modify, say, the Form_Toolbar class in VPMFORMS, the subclasses in VPMFORMS of the Form_Toolbar class inherit your modifications.

Tip - Inheritance in VPM-Level Classes: You will find that all the classes in a VPM-level class library inherit from other higher-level classes in the same library. So, if you modify a class in a VPM-level class library, any subclasses in the same library inherit from it.

How the DEV-Level Classes Inherit

Now, letís turn to the DEV-level class libraries to see how they inherit. The Visual FoxPro Class Browser is shown below with the DEVFORMS class library open. The DEVFORMS class library contains VPM Enterprise form and toolbar classes at the VPM Enterprise level.

The Class Browser shows the classes in DEVFORMS in a list. Notice that there is no inheritance hierarchy! Thatís because each class in DEVFORMS is a subclass of the class in VPMFORMS with the same name, not a higher-level class in DEVFORMS.

A form class in the DEVFORMS class library inherits from the class with the same name in the VPMFORMS library. So, if you modify, the Form_Toolbar class in DEVFORMS, no other class in DEVFORMS inherits your modifications. However, if you modify, the Form_Toolbar class in VPMFORMS, your modifications are inherited by the Form_Toolbar class in DEVFORMS and the form classes in DEVFORMS with the same names as the subclasses in VPMFORMS of the Form_Toolbar class. Whew! Thatís a little tough to understand.

We need a concrete example. Here goes! The Form_Singlerecord class in VPMFORMS is a subclass of the Form_Toolbar class in VPMFORMS and, therefore, inherits from the Form_Toolbar class. OK, so far? The Form_Singlerecord class in DEVFORMS is a subclass of the Form_Singlerecord class in VPMFORMS. So, if you modify the Form_Toolbar class in VPMFORMS:

∑       The Form_Singlerecord class in VPMFORMS inherits your modifications because itís a subclass of the Form_Toolbar class in VPMFORMS.

∑       The Form_Singlerecord class in DEVFORMS inherits your modifications because itís a subclass of the Form_Singlerecord class in VPMFORMS.

∑       And, of course, the Form_Toolbar class in DEVFORMS inherits the modifications because it's a subclass of the Form_Toolbar class in VPMFORMS.

Got it?

If Visual FoxPro supported multiple-inheritance among classes, the Form_Singlerecord class in DEVFORMS could be constructed so that it inherited modifications to the Form_Toolbar class in DEVFORMS and the Form_Toolbar and Form_Singlerecord classes in VPMFORMS. Unfortunately, multiple inheritance is more theoretical than practical, and it isnít in Visual FoxPro.

Tip - Inheritance in DEV-Level Classes: You will find that all the classes in a DEV-level class library inherit from the class of the same name in the corresponding VPM-level class library. So, if you modify a class in a DEV-level class library, none of the other classes in the DEV-level class library inherit your modifications.

How the PRO-Level Classes Inherit

Now, letís turn to the PRO-level class libraries to see how they inherit. The Visual FoxPro Class Browser is shown below with the PROFORMS class library open. The PROFORMS class library contains VPM Enterprise form and toolbar classes at the project level.

The Class Browser shows the classes in PROFORMS in a list. Notice that there is no inheritance hierarchy! Thatís because each class in PROFORMS is a subclass of the class in DEVFORMS with the same name, not a higher-level class in PROFORMS.

Tip Ė DEV-Level and PRO-LEVEL Classes Inherit Just the Same!: It turns out that class inheritance at the DEV-level and PRO-level works exactly the same. So, if you modify a class in a PRO-level class library, none of the other classes in the PRO-level class library inherit your modifications. Thatís just like the DEV-level.

Differences Between DEV-Level and PRO-Level Classes

There are two main differences between the DEV-level and PRO-level Classes:

1.   Parent Classes: The two class levels inherit from different parents.

∑       The parents of the DEV-Level classes are the VPM-Level classes.

∑       The parents of the PRO-Level classes are the DEV-Level classes.

2.    Scope:

∑       Changes to DEV-level classes affect all your applications.

∑       Changes to PRO-level classes affect only the application whose project contains the PRO-level classes that you change.

Tip Ė DEV-Level vs PRO-Level Classes: When you want to make a class change that will affect all your applications, change the DEV-level class. When you want your change to only affect one project, change that projectís PRO-level class.

More:

Where to Modify Classes