DialogFunc Prototype

Syntax:
Function
dialogfunc(DlgItem$, Action%, SuppValue%) _
As Boolean
Select
Case Action%
Case 1 ' Dialog box initialization
...
Case 2 ' Value changing or button pressed
...
Case 3 ' TextBox or ComboBox text changed
...
Case 4 ' Focus changed
...
Case 5 ' Idle
...
End
Select
End
Function
Group: Dialog Function
Description:
A dialogfunc implements the dynamic dialog capabilities.
Parameter Description

DlgItem This string value is the name of the user dialog item's field.
Action This numeric value indicates what action the dialog function is being asked to do.
SuppValue This numeric value provides additional information for some actions.
Action Description
  1. Dialog box initialization. DlgItem is a null string. SuppValue is the dialog's window handle. Set dialogfunc = True to terminate the dialog.
  2. CheckBox, DropListBox, ListBox or OptionGroup: DlgItem's value has changed. SuppValue is the new value.
    CancelButton
    , OKButton or PushButton: DlgItem's button was pushed. SuppValue is meaningless. Set dialogfunc = True to prevent the dialog from closing.
  3. ComboBox or TextBox: DlgItem's text changed and losing focus. SuppValue is the number of characters.
  4. Item DlgItem is gaining focus. SuppValue is the item that is losing focus. (The first item is 0, second is 1, etc.) Note: When the first item receives the focus there is no item that is losing focus. In that case SuppValue is -1.
  5. Idle processing. DlgItem is a null string. SuppValue is zero. Set dialogfunc = True to continue receiving idle actions.
See Also: Begin Dialog.
Example:

Sub Main
Begin Dialog UserDialog 200,120,.DialogFunc
Text
10,10,180,15,"Please push the OK button"
TextBox
10,40,180,15,.Text
OKButton
30,90,60,20
PushButton
110,90,60,20,"&Hello"
End
Dialog
Dim
dlg As UserDialog
Debug
.Print Dialog(dlg)
End
Sub

Function
DialogFunc%(DlgItem$, Action%, SuppValue%)
Debug
.Print "Action=";Action%
Debug
.Print "DlgItem$;"=""";DlgText$(DlgItem$);""""
Debug
.Print "SuppValue=";SuppValue%
Select
Case Action%
Case 1 ' Dialog box initialization
Beep

Case 2 ' Value changing or button pressed
If
DlgItem$ = "Hello" Then
MsgBox
"Hello"
DialogFunc% = True 'do not exit the dialog
End
If
Case 4 ' Focus changed
Debug
.Print "DlgFocus=""";DlgFocus();""""
End
Select
End
Function