<< Click to Display Table of Contents >> Dialog definition |
To create a dialog box, you need to insert a dialog definition in the script. You can use either the built-in dialog editor (see the section Using the dialog editor) or enter the dialog definition manually.
On the next pages, we will have a closer look at dialog definitions.
Syntax of a dialog definition
Dialog definitions must be surrounded by the statements Begin Dialog and End Dialog:
Begin Dialog DialogName [X, Y,] Width, Height, Title$ [,.DialogFunction]
' Define your dialog controls here
End Dialog
The individual parameters have the following meaning:
Parameter |
Description |
DialogName |
Name of the dialog definition. After you have set up the dialog definition, you can declare a variable of this type (Dim Name As DialogName). |
X, Y |
Optional. Sets the screen coordinates for the upper left corner of the dialog box (in screen pixels). |
Width, Height |
Sets the width and height of the dialog (in screen pixels). |
Title$ |
The title of the dialog. It will be shown in the title bar of the dialog. |
.DialogFunction |
The (optional) dialog function for this dialog. Allows you to dynamically enable and disable dialog controls while the dialog is displayed and makes it possible to create nested dialogs (see the section The dialog function). |
Inside the dialog definition, you can define the dialog controls that you want to display. Use the keywords covered on the next pages for this.
Example:
Sub Main
Begin Dialog QuitDialogTemplate 16, 32, 116, 64, "Quit?"
Text 4, 8, 108, 8, "Would you like to quit the program?"
CheckBox 32, 24, 63, 8, "Save changes", .SaveChanges
OKButton 12, 40, 40, 14
CancelButton 60, 40, 40, 14
End Dialog
Dim QuitDialog As QuitDialogTemplate
rc% = Dialog(QuitDialog)
' Here you can evaluate the result (rc%) of the dialog
End Sub