Setting Up VFP Options for Form and Control Classes

The Forms and Controls pages on the Visual FoxPro Tools menu Options dialog allow you to:

∑       Forms: Specify a default form class template to be used when you create a new form, and

∑       Controls: Add form and control class libraries to the Form Controls Toolbar (also, known as registering your class libraries).

You will find that specifying a default form class template and registering your form and control class libraries will make it easier to create forms in a project.

However, before you specify a default form class template and register the class libraries for a project, you need to decide whether to use the VPM, DEV or PRO level form and control classes.

How to Choose the Form and Control Class Level

When you create forms, you can choose whether you want your forms and controls based on the VPM, DEV or PRO level classes. 

When to Use PRO-Level Form and Control Classes

If you want to be able to change the form and control classes for a specific project only, you should base the forms you create for the project on the PRO-level form and control classes (PROFORMS.VCX and PROCTRLS.VCX in the project's home directory).

Warning!!!:  If you choose to base your forms and controls on PRO-level classes, then whenever you open a project to create forms you should make sure that the default form class template and the registered form and control class libraries belong to that project.  In other words, make sure that the form and control class libraries you use for the project are the libraries in that project's home directory, not some other projectís home directory.

When to Use VPM or DEV Level Form and Control Classes

If you don't need to make project level changes to the form and control classes for a project, you can use the VPM or DEV level form and control classes  in the VPM Enterprise home directory. Choosing whether to use VPM or DEV level form and control classes depends on the same factors discussed in Where to Modify Classes.

Tip - a Small Advantage:  If you use the VPM or DEV level class libraries for all your projects, you will set up the Forms and Controls pages on the VFP Options dialog to specify a default form class template and to register the form and control class from the VPM or DEV level form and control class libraries.  Then, you will not have to worry about changing the form and control class libraries whenever you open a new project. However, you will lose the advantage of being able to modify a project's forms and controls through the project-level classes.

Specifying the Default Form Class Template

After you decide whether you want to use the VPM, DEV or PRO level form and control classes, you should specify a default form class template on the Forms page of the VFP Options dialog. If you specify a default form class template, the new forms you create will be automatically based on the default form class you choose.  Choose a default form class that matches the type of form you create most frequently.

ō To specify a default form class template

1.   From the VPM Enterprise File menu choose Exit to FoxPro or click the Exit to FoxPro button on the VPME toolbar.

2.   From the Visual FoxPro Tools menu, choose Options.

3.   In the Options dialog, choose the Forms tab.

4.   Click the Form check box in the Template Classes box. Visual FoxPro displays the Form Template dialog. The visual class libraries in the VPM Enterprise home directory will be displayed. If you have a VPME project open, the class libraries in the project's home directory will be displayed.

5.   Locate and highlight the VPMFORMS.VCX or DEVFORMS.VCX class library in the VPM Enterprise home directory.  (Alternatively, locate and highlight the PROFORMS.VCX class library in the projectís home directory -- see discussion above.)

Caution: If you use PRO-level class libraries, be sure you use the PRO-level class libraries in your projectís home directory. Do not use the PRO-level class libraries in the VPM Enterprise New Project directory. The PRO-level class libraries in the New Project directory are templates used by VPM Enterprise to create new projects.

6.   The Class Name box on the right side of the Form Template dialog displays the names of the form classes in the selected form class library.  Highlight the name of the form class that you want to use as the project's default form class (form_toolbar is a good choice).  Click OK.

7.   Click the Set as Default button at the bottom of the Options dialog.  Click OK.

Registering the Form and Control Class Libraries

After you decide whether you want to use the VPM, DEV or PRO level form and control classes, you should register the form and control class libraries you will be using on the Controls page of the VFP Options dialog. If you register the form and control class libraries that you want to use, the libraries will be on the Form Controls Toolbar when you use the Form Designer.

ō To register the form and control class libraries

1.   From the VPM Enterprise File menu, choose Exit to FoxPro or click the Exit to FoxPro button on the VPME toolbar.

2.   From the Visual FoxPro Tools menu, choose Options.

3.   In the Options dialog, choose the Controls tab.

4.   Click the Add button. Visual FoxPro displays the Open dialog.  The visual class libraries in the VPM Enterprise home directory will be displayed. If you have a VPME project open, the class libraries in the project's home directory will be displayed.

5.   Locate and highlight the VPMCTRLS.VCX or DEVCTRLS.VCX class library in the VPM Enterprise home directory.  (Alternatively, locate and highlight the PROCTRLS.VCX class library in the projectís home directory -- see discussion above.)  Click Open.

Caution: If you use PRO-level class libraries, be sure you use the PRO-level class libraries in your projectís home directory. Do not use the PRO-level class libraries in the VPM Enterprise New Project directory. The PRO-level class libraries in the New Project directory are templates used by VPM Enterprise to create new projects.

6.   Repeat steps 4 and 5 to register the VPMFORMS.VCX, DEVFORMS.VCX or PROFORMS.VCX class library in the VPM Enterprise home directory.

7.   Click the Set as Default button at the bottom of the Options dialog.

 

 

 

More:

Creating Forms: The Basics