CREATE FORM Command

See Also

Opens the Form Designer.

Syntax

CREATE FORM [FormName | ?]
  [AS cClassName FROM cClassLibraryName | ?]
  [NOWAIT] [SAVE] [DEFAULT]
  [[WINDOW WindowName1]
  [IN [WINDOW] WindowName2 | IN SCREEN]]

Arguments

FormName

Specifies the file name for the form. If you don't specify an extension for the file name, Visual FoxPro automatically assigns an .scx extension. If a form file with the name you specify already exists, you are asked if you want to overwrite the existing file (if SET SAFETY is set to ON).

?

Displays the Create dialog box from which you can choose a form or enter the name of a new form to create.

AS cClassName FROM cClassLibraryName | ?

Creates a new form from a form class in a .vcx visual class library. cClassName specifies the name of the user-defined form class from which the new form is created. An error is generated if cClassName isn't based on a form. cClassLibraryName specifies the name of the .vcx visual class library containing the form class specified with cClassName. Include ? to display the Open dialog box, allowing you to specify the visual class library.

NOWAIT

Continues program execution after the Form Designer has been opened. The program doesn't wait for the Form Designer to be closed, but continues execution on the program line immediately following the line that contains CREATE FORM NOWAIT. If you omit NOWAIT, when CREATE FORM is issued in a program, the Form Designer is opened and program execution pauses until the Form Designer is closed.

Including NOWAIT has no effect on CREATE FORM when it is issued in the Command window.

SAVE

When issued in a program, leaves the Form Designer open after another window is brought forward. Including the SAVE option has no effect when issued from the Command window.

DEFAULT

Specifies that the Form Designer is opened with the default Visual FoxPro form template, overriding a default form template specified on the Forms tab of the Options dialog.

For additional information about form templates, see Chapter 9, Creating Forms, in the Programmer's Guide.

WINDOW WindowName1

Specifies a window whose characteristics the Form Designer takes on. For example, if the window is created with the FLOAT option of DEFINE WINDOW, the Form Designer can be moved. The window need not be active or visible, but it must be defined.

The Form Designer has a default size that can be larger than the window from which it takes its characteristics. In this case, the Form Designer still assumes the characteristics of the window in which it is placed. The upper-left corner of the Form Designer is placed at the same coordinates as the upper-left corner of the window, and extends beyond the window's borders.

IN [WINDOW] WindowName2

Specifies a parent window in which the Form Designer is opened. The Form Designer doesn't assume the characteristics of the parent window and cannot be moved outside the parent window. If the parent window is moved, the Form Designer moves with it.

The parent window must first be defined with DEFINE WINDOW, and must be visible, to access the Form Designer.

IN SCREEN

Specifies that the Form Designer is explicitly opened in the main Visual FoxPro window, after the Form Designer has been placed in a parent window. The Form Designer is placed in a parent window by including the IN WINDOW clause.

Remarks

Issuing CREATE FORM without any additional arguments opens a new form in the Form Designer. When you exit the Form Designer, you are prompted to save the form with a different name.