Opening a Dialog Box
Standard forms that are opened as Dialog boxes.
Xdialog dialog boxes. Refer to ((The UI_DLG_BOX__Command|The UI_DLG_BOX Command))
This topic discusses standard forms that are opened as Dialog boxes. A dialog box is a form that has been opened as a dialog box. The key difference between a normal form and a dialog box is that a dialog box is modal. That means that you cannot click on any object outside the dialog box until the dialog box is closed. You can only open a form as a dialog box using Xbasic or Action Scripting. You cannot open a form as a dialog box from the Control Panel. An Xbasic script that opens up a dialog box will pause until the dialog box is closed. Once the dialog is closed, the script will resume execution. There are four ways to open a form as a dialog:
The FORM.DIALOG() method
A "quick and dirty" method that is useful when you just need to know which button on the dialog the user pressed to close the dialog.
The FORM.VIEW() method
The FORM.VIEW() method (with the "Dialog" parameter) is a more versatile method. This method should be used when you want to read values that the user entered into the dialog box, in addition to knowing which button the user pressed to close the dialog box.
The FORM.VIEWQUERIED() method
The FORM.VIEWQUERIED() method (with the "Dialog" parameter) is a variant of the FORM.VIEW() method. Use this method when you want to specify a filter and order expression to control which records are displayed in the dialog box.
The FORM.LOAD() method
The FORM.LOAD() method (with the "Dialog" parameter) is the most versatile method. This method is similar to the FORM.VIEW() method, but is more versatile because your Xbasic script can manipulate controls and records in the dialog box. With the FORM.VIEW() method, the script pauses as soon as the dialog is opened and only continues when the dialog is closed. However, with the FORM.LOAD() method, the script continues to execute until the dialog box is made visible using the <FORM>.SHOW() method.
For example, the following script shows how a dialog box can be opened, and a new record entered into the dialog:
:Form.load("Customer","Dialog") 'The script will continue to execute :customer.new_record() :customer.show()
The script will now pause. The dialog is automatically activated when it is shown. Typically, when you design a form that will be opened as a dialog box, you will want to set the following form properties so that the form looks like a standard Windows dialog box:
Select the background of the form and right click.
On the Form tab, check Hide status bar.
On the Window tab, clear Sizeable, Minimize button, and Maximize button.