version 3
DIALOG ({table; }form)
| Parameter | Type | Description | |
| table | Table | Table owning the form or | |
| Default table if omitted | |||
| form | Form | Form to display as dialog |
Description
The command DIALOG presents the form form to the user. This command is often used to get information from the user through the use of variables, or to present information to the user, such as options for performing an operation.
It is common to display the form inside a modal window created with the Open window command.
Here is a typical example of a dialog:
In a dialog, data entry can be performed only by using variables. Fields can be displayed with the current values, but are not enterable.
Tip: Sometimes dialogs can be simulated by ADD RECORD, if you need the capabilities provided by field data entry. In this case, if the form is accepted, a record is added to the table.
Tip: Conversely, data entry can be performed using the DIALOG command. In this case, you must create and save the record. DIALOG does not manipulate records.
Use DIALOG instead of ALERT, CONFIRM, or Request when the information that must be presented or gathered is more complex than those commands can manage.
Unlike ADD RECORD or MODIFY RECORD, DIALOG does not use the current input form. You must specify the form to be used in the form parameter. Also, the default button panel is not used if buttons are omitted. Instead the OK and Cancel buttons are automatically created. Adding any custom button removes the default OK and Cancel buttons.
The dialog is accepted if the user clicks an Accept button or presses the Enter key (numeric key pad), or if the ACCEPT command is executed.
The dialog is canceled if the user clicks a Cancel button or presses the cancel key combination (Ctrl-Period on Windows, Command-Period on Macintosh), or if the CANCEL command is executed.
After a call to DIALOG, if the dialog is accepted, OK is set to 1; if it is canceled, OK is set to 0.
Example
The following example shows the use of DIALOG to specify search criteria. A custom form containing the variables vName and vState is displayed so the user can enter the search criteria.
Open window (10;40;370;220) ` Open a modal window DIALOG([Company];"Search Dialog") ` Display a custom search dialog CLOSE WINDOW ` No longer need the modal window If (OK=1) ` If the dialog is accepted QUERY ([Company];[Company]Name=vName;*) QUERY ([Company];&;[Company]State=vState) End if
See Also
ACCEPT, ADD RECORD, CANCEL, Open window.
System Variables or Sets
After a call to DIALOG, if the dialog is accepted, OK is set to 1; if it is canceled, OK is set to 0.