User Guide

648
Chapter 46
Dialog Monitor Functions (Scripting)
A dialog monitor function defines the behavior of a dialog box for each of a number
of specified cases. The function takes the following (generic) form:
Function DialogFunc(strDlgItem as String, intAction as Integer, i ntSuppValue as Integer)
Select Case intAction
Case 1 ' dialog box initialization
... 'statements to execute when dialog box is initialized
Case 2 ' value changing or button p ressed
... 'statements...
Case 3 ' TextBox or ComboBox text changed ...
Case 4 ' focus changed ...
Case 5 ' idle ...
End Select
End Function
Parameters. The function must be able to pass three parameters: one string
(strDlgItem)andtwointegers(intAction and intSuppValue). The parameters
are values passed between the function and the dialog box, depending on what action
is taken.
For example, when a user clicks a control in the dialog box, the name of the
controlispassedtothefunctionas
strDlgItem (the field name is specified in the
dialog box definition). The second parameter (
intAction) is a numeric value that
indicates what action took place in the dialog box. The third parameter is used for
additional information in some cases. You must include all three parameters in the
function definition even if you do not use all of them.
Select Case intAction. The value of intAction indicates what action took place in
the dialog box. For example, when the dialog box initializes, intAction =1.Ifthe
user presses a button, intAction changes to 2, and so on. There are five possible
actions, and you can specify statements that execute for each action as indicated
below. You do not need to specify all five possible cases-only the ones that apply. For
example, if you do not want any statements to execute on initialization, omit Case 1.
Case intAction = 1. Specify statements to execute when the dialog box is initialized.
For example, you could disable one or more controls or add a beep. The string
strDlgItem is a null string; intSuppValue is 0.