Share via


Using Form Templates

Form templates allow you to set default properties for your forms so that you can easily give all the forms in your application a consistent look and feel. You could include a company logo, for instance, and use a consistent color scheme in all your forms by designing a template form class with these attributes. If the company logo changes, you could change the picture in the template form class and all the forms you created based on the template would automatically inherit the new logo.

You can add custom properties and methods to the Visual FoxPro form class so that these properties and methods are available to each form in your application. If you are used to creating variables and user-defined procedures that are scoped to a form, using custom properties and methods provides this functionality, and also allows you to have a cleaner encapsulation model.

You can specify form set templates the same way you set form templates. The following combinations are possible:

  • Both form set and form templates are specified.

    Choosing Form in the New dialog box (and all the other ways to create a new form) will automatically create a form set based on the template form set class. When you choose Add New Form from the Form menu in the Form Designer, a form based on your form template is added to the form set.

  • Only the form set template is specified.

    Choosing Form in the New dialog box (and all the other ways to create a new form) will automatically create a form set based on the template FormSet class. When you choose Add New Form from the Form menu in the Form Designer, a form based on the Visual FoxPro Form base class is added to the form set.

  • Only the form template is specified.

    Choosing Form in the New dialog box (and all the other ways to create a new form) will automatically create a form based on the template Form class.

  • No templates are specified.

    Choosing Form in the New dialog box (and all the other ways to create a new form) will automatically create a form based on the Visual FoxPro Form base class.

For more information, see How to: Set Form Templates.

See Also

Tasks

How to: Create Forms with Local and Remote Data

How to: Save a Form as HTML

How to: Set the Design Area for a Form

How to: Manage Multiple Instances of a Form

Reference

Options Dialog Box (Visual FoxPro)

Other Resources

Working with Forms

Creating Forms