BeginDialog...EndDialog

User dialog function.

The BeginDialog...EndDialog function defines a dialog box with its controls. Not available in WinTask Lite.

Usage

Used to ask the user multiple questions in a complex dialog box.

Syntax

BEGINDIALOG <dialog_name> <x>,<y>,<width>,<height>
CAPTION "Dialog Box Title"

PUSHBUTTON "Button_label",<button_namen>,<x>,<y>,<width>,<height>
DEFPUSHBUTTON "Button_label",<button_name>,<x>,<y>,<width>,<height>
EDITTEXT <Edit_namen$>,<x>,<y>,<width>,<height>[,protected]
TEXT "Text",<x>,<y>
COMBOBOX <Combo_namen$()>,<x>,<y>,<width>,<height>,<SelCombon$>[,Sorted]
LISTBOX <List_namen$()>,<x>,<y>,<width>,<height>,<SelListn$>[,Sorted]
GROUPBOX ["Groupbox_label"],<x>,<y>,<width>,<height>
CHECK "check_label",<Check1>,<x>,<y>
RADIO "radio_label",<Radio1>,<x>,<y>
ICON "Type",<x>,<y>,<width>,<height>

ENDDIALOG

 

Parameters

<dialog_name>: name of the dialog box ; this name is used later in the script in order to display the dialog box.

<x>,<y>,<width>,<height>: coordinates of the top-left point of the dialog box, width and height of the dialog box.

On the CAPTION line, the title of the dialog box is specified.

Note that the first line of the lines defining the controls within the Dialog is the control which has the focus at execution.

Example

BEGINDIALOG Box1 231, 130, 350, 413
CAPTION "Example"

...
...

ENDDIALOG

 

Different types of buttons can be displayed using the statements PUSHBUTTON and DEFPUSHBUTTON.

 
DEFPUSHBUTTON defines the default button; only one default button is allowed.
"button_label" defines the label of the button (it can be a variable).
<button_namen> defines the result variable (set to 1 this button has been clicked).
<x>,<y>,<width>,<height>: coordinates of the top-left point of the button, width and height of the button.

Examples

BEGINDIALOG Box1 231, 130, 350, 413
CAPTION "Example"

DEFPUSHBUTTON "&OK", Button1, 50, 350, 65, 20
PUSHBUTTON "&Cancel", Button3, 137, 350, 65, 20
...

ENDDIALOG

Depending on which button is pressed, different actions are made:

BEGINDIALOG Dialog1 225, 176, 240, 153
CAPTION "Example"

DEFPUSHBUTTON "Button2", Button2, 57, 47, 59, 22
PUSHBUTTON "Button3", Button3, 143, 43, 47, 28

ENDDIALOG

CallDialog Dialog1

If button2=1 then
  shell("my_program.exe")
endif

if button3=1 then
  msgbox("button3 pressed")
endif

 

A Text control (static) can be added in the dialog box using the statement TEXT.

"Text" specifies the text to be displayed.
<x>,<y>: coordinates of the top-left point of the text.

Example

BEGINDIALOG Box1 231, 130, 350, 413
CAPTION "Example"

TEXT "Type your name : ", 25, 30
...

ENDDIALOG

 

An Editbox can be added in the dialog box using the statement EDITTEXT.

<Edit_namen$>: string to be displayed or result string.
<x>,<y>,<width>,<height>: coordinates of the top-left point of the Editbox, width and height of the Editbox.
Protected : optional parameter; hides the input by filling the field by *.

Example

BEGINDIALOG Box1 231, 130, 350, 413
CAPTION "Example"

EDITTEXT Edit1$, 30, 55, 193, 24
...

ENDDIALOG

 

A Combobox can be added in the dialog box using the statement COMBOBOX.

<Combo_namen$>: string array with all the strings to be displayed in the combobox. You must define the array first using the DIM statement. Remember that the first item of an array starts at 0.
<SelCombon$>: result string (the one selected by the user).
<x>,<y>,<width>,<height>: coordinates of the top-left point of the combobox, width and height of the combobox.
Sorted: optional parameter, if used, the strings are sorted inside the combobox.

Example

DIM selec$(15)

selec$(0)="Choice 1"
selec$(1)="Choice 2"

choice$=selec$(1)

BEGINDIALOG Box1 231, 130, 350, 413
CAPTION "Example"

COMBOBOX selec$(), 180, 135, 125, 75, choice$,sorted
...

ENDDIALOG

 

A ListBox can be added in the dialog box using the statement LISTBOX.

<List_namen$>: string array with all the strings to be displayed in the list. You must define the array first using the DIM statement.
<SelListn$>: result string (the one selected by the user).
<x>,<y>,<width>,<height>: coordinates of the top-left point of the listbox, width and height of the listbox.
Sorted: optional parameter, if used, the strings are sorted inside the listbox.

Example

DIM List1$(10)
BEGINDIALOG Box1 231, 130, 350, 413
CAPTION "Example"

LISTBOX List1$(), 30, 135, 125, 75, SelList1$
...

ENDDIALOG

 

Radio Buttons and Checkboxes can be added in the dialog box using the statements RADIO and CHECK.

"check_label": label of the radio button or checkbox, it can be a variable.
<Checkn>,<Radion>: integer; 1 if the button has been checked, or if you want it checked at execution.
<x>,<y>: coordinates of the top-left point of the button.

Example

BEGINDIALOG Box1 231, 130, 350, 413
CAPTION "Example"

RADIO "Option 1", Radio1, 50, 263
CHECK "Check 1", Check1, 200, 263
...

ENDDIALOG

radio1=1
CallDialog Box1

 

A Groupbox can be added using the statement GROUPBOX.

"Groupbox_label": title of the group (optional).
<x>,<y>,<width>,<height>: coordinates of the top-left point of the frame, width and height of the group frame.

The statement Groupbox must be just before the Radio statements defining the radio buttons to be included in the group.

Within such a group, if you check a radio button, the radio button previously checked becomes unchecked.

Example

BEGINDIALOG Box1 231, 130, 350, 413
CAPTION "Example"

GROUPBOX "Options : ", 30, 233, 125, 100
RADIO "Option 1", Radio1, 50, 263
RADIO "Option 2", Radio2, 50, 283
...

ENDDIALOG

 

An Icon can be added in the dialog box using the statement ICON.

"Type" can be:

"Stop": red cross icon.
"Info": I icon.
"Exclamation": ! icon.
"Question": ? icon.
"Winlogo": Windows logo icon.

<x>,<y>,<width>,<height>: coordinates of the top-left point of the icon, width and height of the icon.

Example

BEGINDIALOG Box1 231, 130, 350, 413
CAPTION "Example"

ICON "Info", 260, 25, 50, 50
...

ENDDIALOG