Partilhar via


Displaying a Child Form Inside a Top-Level Form

If you've created a child form in which the ShowWindow property is set to 1—In Top-Level Form, you don't directly specify the top-level form that acts as the child form's parent. Instead, Visual FoxPro assigns the child form to a parent at the time the child window is displayed.

To display a child form inside a top-level form

  1. Create a top-level form.

  2. In the event code of the top-level form, include the DO FORM command, specifying the name of the child form to display.

    For example, create a button in the top-level form, and then in the Click event code for the button, include a command such as this one:

    DO FORM MyChild
    

    Note   The top-level form must be visible and active when the child form is displayed. Therefore, you cannot use the Init event of the top-level form to display a child form, because the top-level form will not yet be active.

  3. Activate the top-level form, and then if necessary, trigger the event that displays the child form.

See Also

Creation of Single- and Multiple-Document Interfaces | Specifying a Form Type | Hiding the Main Visual FoxPro Window | Creating Forms | Adding a Menu to a Top-Level Form | Extending Forms with Form Sets