MODIFY FORM Command
Opens the Form Designer so you can modify or create a Form.
MODIFY FORM [FormName | ?][NOWAIT][METHOD MethodName] [NOENVIRONMENT][SAVE] [[WINDOW WindowName1] [IN [WINDOW] WindowName2 | IN SCREEN]]
- 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.
- Displays the Open dialog box from which you can choose an existing Form or enter the name of a new Form to create.
- 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 MODIFY FORM NOWAIT. If you omit NOWAIT, when MODIFY FORM is issued in a program the Form Designer is opened and program execution pauses until the Form Designer is closed.
NOWAIT is effective only from within a program. It has no effect on MODIFY FORM when issued from the Command window. If NOWAIT is included with the METHOD clause, be sure to place NOWAIT before the METHOD clause or NOWAIT will be ignored.
- METHOD MethodName
- Specifies an event or method for which the Code window is opened in the Form Designer. The METHOD clause makes it possible for you to immediately begin editing event or method code in the Form Designer.
MethodName supports the Visual FoxPro object syntax. For example, to immediately edit the Click event code for a text box named txtFirstName in a form named frmAddress, use the following command:
MODIFY FORM frmAddress METHOD txtFirstName.Click
If you only include an event or method name in the METHOD clause, the Code window is opened for the form's event or method. For example, to immediately edit the Click event code for a form named frmAddress, use the following command:
MODIFY FORM frmAddress METHOD Click
- Included for backward compatibility with 2.x screens, preventing the environment saved with the screen from being restored.
In Visual FoxPro, the data environment associated with a Visual FoxPro form is restored by setting the data environment AutoOpenTables property to true (.T.), which is the default. To make sure that the form environment is closed when the form is releases, set the data environment AutoCloseTables property to true (.T.), which is also the default.
When you create or modify forms, you can save the current Visual FoxPro data environment with the form definition file. Saving the Visual FoxPro data environment places additional records in the form definition table for all open tables and index files, the index order, and any relationships between the tables.
- 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.
- 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.
Issuing MODIFY FORM without any arguments displays the Open dialog box. You can save the form with a different name when you close the Form Designer.
The following example open the stop watch (SWATCH.SCX) control sample in the Form Designer.
MODIFY FORM (HOME(2) + 'solution\controls\timer\swatch.scx')