DlgFocus Instruction/Function |
Syntax:
DlgFocus DlgItem
or
DlgFocus[$]()
Group:
Description:
Instruction: Move the focus to this DlgItem.
Function: Return the field name which has the focus as a string.
This instruction/function must be called directly or indirectly from a dialogfunc.
Parameters:
Parameter |
Description |
If this is a numeric value then it is the dialog item number. The first item is 0, second is 1, etc. If this is a string value then it is the dialog item's field name. |
Example:
Sub Main
Begin DialogUserDialog 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"
EndDialog
Dim dlg As UserDialog
Debug.PrintDialog(dlg)
EndSub
Function DialogFunc%(DlgItem$, Action%, SuppValue%)
Debug.Print "Action=";Action%
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
EndIf
Case 4 ' Focus changed
Debug.Print "DlgFocus=""";DlgFocus();""""
EndSelect
EndFunction