次の方法で共有


How to: Extend Forms with Form Sets

You can manipulate multiple forms as a group by including them in a form set. A form set has these benefits:

  • You can show or hide all the forms in a form set at one time.

  • You can visually arrange multiple forms at once to control their relative positions.

  • Because all the forms in a form set are defined in a single .scx file with a single data environment, you can automatically synchronize record pointers in multiple forms. If you change the record pointer in a parent table in one form, the child records in another form are updated and displayed.

    Note

    All the forms and all the objects on the forms are loaded when you run the form set. Loading many forms with a number of controls might take several seconds.

Creating a New Form Set

A form set is a parent container for one or more forms. When you are in the Form Designer, you can create a form set.

To create a form set

  • From the Form menu, choose Create Formset.

If you don't want to work with multiple forms as a group of forms, you don't need to create a form set. Once you've created a form set, you can add forms to it.

Adding and Removing Forms

Once you've created a form set, you can add new forms and remove forms.

To add additional forms to a form set

  • From the Form menu, choose Add New Form.

To remove a form from a form set

  1. In the Form box at the bottom of the Form Designer, select the form.

  2. From the Form menu, choose Remove Form.

If you have a single form in a form set, you can remove the form set so that you have only the form.

To remove a form set

  • From the Form menu, choose Remove Formset.

Forms are saved in table format to a file with an .scx extension. When you create a form, the .scx table contains a record for the form, a record for the data environment, and two records for internal use. A record is added for each object you add to the form or to the data environment. If you create a form set, an additional record is added for the form set and for each new form. The parent container of each form is the form set. The parent container of each control is the form that it is placed on.

Tip

When you run a form set, you may not want all forms in the form set initially visible. Set the Visible property to false (.F.) for forms you don't want displayed when the form set runs. Set the Visible property to true (.T.) when you want the forms displayed.

See Also

Tasks

How to: Add a Menu to a Top-Level Form

How to: Add Visual FoxPro Containers

Concepts

Adding Objects to Forms

Reference

Form Designer

Other Resources

Creating Forms