2.5 Templates

Templates

Now that you know how to use form classes and forms together, you're missing only one little piece of information: "How do we create forms with a certain base class?"

There are two different ways. One is to use the AS keyword in the CREATE FORM command, as in the following example:

CREATE FORM NewForm AS MyForm FROM Forms.vcx

The other way is to define a default template in the Visual FoxPro Options dialog. The class you define there will be used for each CREATE FORM command, unless you specify a different class using the AS clause. Figure 1 shows where you can find that setting in the Tools/Options dialog.

Figure 1. You can set the default form class in the Options dialog.

Defining a template class is a good idea if you create many forms based on the same class. This could happen when you create lots of data entry forms, for instance. However, when you create many forms based on different classes, I recommend using the AS clause instead.

If you have specified a template class and you want to create a form that is not subclassed from one of your own classes, you can use the DEFAULT keyword:

DEFINE FORM NewForm DEFAULT



Advanced Object Oriented Programming with Visual FoxPro 6. 0
Advanced Object Oriented Programming with Visual FoxPro 6.0
ISBN: 0965509389
EAN: 2147483647
Year: 1998
Pages: 113
Authors: Markus Egger

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net