DlgEnable (function)

Syntax DlgEnable (ControlName$ | ControlIndex)
Description Returns True if the specified control is enabled; returns False otherwise.
Comments Disabled controls are dimmed and cannot receive keyboard or mouse input. The ControlName$ parameter contains the name of the .Identifier parameter associated with a control in the dialog box template. A case-insensitive comparison is used to locate the specific control within the template. Alternatively, by specifying the ControlIndex parameter, a control can be referred to using its index in the dialog box template (0 is the first control in the template, 1 is the second, and so on). You cannot disable the control with the focus.
Example This example checks the status of a checkbox at the end of the dialog procedure and notifies the user accordingly.
Function DlgProc(ControlName$,Action%,SuppValue%) As Integer
  If Action% = 2 Then
    'Enable the next three controls.
    If DlgControlId(ControlName$) = 2 Then
      For i = 3 to 5
       DlgEnable i,DlgValue("CheckBox1")
      Next i
      DlgProc = 1  'Don't close the dialog box.
    End If
  ElseIf Action% = 1 Then
    'Set initial state upon startup
    For i = 3 to 5
      DlgEnable i,DlgValue("CheckBox1")
    Next i
  End If
  If  DlgEnable(i) = True Then
    MsgBox "You do not have the required disk space.",ebExclamation,"Insufficient Disk Space"
  End If
End Function
Sub Main()
  Begin Dialog UserDialog ,,180,96,"Untitled",.DlgProc
    OKButton 132,8,40,14
    CancelButton 132,28,40,14
    CheckBox 24,16,72,8,"Click Here",.CheckBox1
    CheckBox 36,32,60,8,"Sub Option 1",.CheckBox2
    CheckBox 36,44,72,8,"Sub Option 2",.CheckBox3
    CheckBox 36,56,60,8,"Sub Option 3",.CheckBox4
    CheckBox 24,72,76,8,"Main Option 2",.CheckBox5
  End Dialog
  Dim d As UserDialog
  Dialog d
End Sub
See Also DlgControl (statement); DlgEnable (statement); DlgFocus (function); DlgFocus (statement); DlgListBoxArray (function); DlgListBoxArray (statement); DlgSetPicture (statement); DlgText (statement); DlgText$ (function); DlgValue (function); DlgValue (statement); DlgVisible (statement); DlgVisible (function).