DlgEnable Instruction/Function

Syntax

DlgEnable DlgItem|$[, Enable]

-or-

DlgEnable(DlgItem|$)

Group

Dialog Function

Description

Instruction: Enable or disable DlgItem|$.

Function: Return True if DlgItem|$ is enabled.

This instruction/function must be called directly or indirectly from a dialogfunc.

Parameter Description
DlgItem|$ 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.
Note: Use -1 to enable or disable all the dialog items at once.
Enable It this numeric value is True then enable DlgItem|$. Otherwise, disable it. If this omitted then toggle it.

Example

Sub Main
Begin DialogUserDialog 210,120,.DialogFunc
Text
10,10,190,15,"Please push the OKButton"
OKButton
30,90,60,20
PushButton 110,90,60,20,"&Disable"
End
Dialog
Dim
dlg As UserDialog
Debug
.PrintDialog(dlg)
End
Sub

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
Select
Case DlgItem$
Case "Disable"
DlgEnable "Text,"False
DialogFunc% = True 'do not exit the dialog
Case "Enable"
DlgText DlgItem$,"&Disable"
DlgEnable "Text,"True
DialogFunc% = True 'do not exit the dialog
End
Select
End
Select
End
Function