DlgEnable (statement)

Syntax

DlgEnable {ControlName$ | ControlIndex} [,isOn]

Description

Enables or disables the specified control.

Comments

Disabled controls are dimmed and cannot receive keyboard or mouse input.

The isOn parameter is an Integer specifying the new state of the control. It can be any of the following values:

0 The control is disabled.

1 The control is enabled.

Omitted Toggles the control between enabled and disabled.

 

Option buttons can be manipulated individually (by specifying an individual option button) or as a group (by specifying the name of the option group).

 

The ControlName$ parameter contains the name of the .Identifier parameter associated with a control in the dialog box 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).

Example

This example uses DlgEnable to turn on/off various dialog options.

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
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

DlgEnable (function); DlgFocus (function); DlgFocus (statement); DlgListBoxArray (function); DlgListBoxArray (statement); DlgSetPicture (statement); DlgText (statement); DlgText$ (function); DlgValue (function); DlgValue (statement); DlgVisible (statement); DlgVisible (function).

More information

D