DlgVisible (statement)

Syntax DlgVisible {ControlName$ | ControlIndex} [,isOn]
Description Hides or shows the specified control.
Comments Hidden controls cannot be seen in the dialog box and cannot receive the focus using Tab. The isOn parameter is an Integer specifying the new state of the control. It can be any of the following values:
1 The control is shown.
0 The control is hidden.
Omitted Toggles the visibility of the control. 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. 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).
Picture Caching When the dialog box is first created and before it is shown, the Basic Control Engine calls the dialog function with action set to 1. At this time, no pictures have been loaded into the picture controls contained in the dialog box template. After control returns from the dialog function and before the dialog box is shown, the Basic Control Engine will load the pictures of all visible picture controls. Thus, it is possible for the dialog function to hide certain picture controls, which prevents the associated pictures from being loaded and causes the dialog box to load faster. When a picture control is made visible for the first time, the associated picture will then be loaded.
Example This example creates a dialog box with two panels. The DlgVisible statement is used to show or hide the controls of the different panels.
Sub EnableGroup(start%,finish%)
  For i = 6 To 13               'Disable all options.
    DlgVisible i,False
  Next i
  For i = start% To finish%     'Enable only the right ones.
    DlgVisible i,True
  Next i
End Sub
Function DlgProc(ControlName$,Action%,SuppValue%)
  If Action% = 1 Then
    DlgValue "WhichOptions",0   'Set to save options.
    EnableGroup 6,8          'Enable the save options.
  End If
  If Action% = 2 And ControlName$ = "SaveOptions" Then
    EnableGroup 6,8          'Enable the save options.
    DlgProc = 1            'Don't close the dialog box.
  End If
  If Action% = 2 And ControlName$ = "EditingOptions" Then
    EnableGroup 9,13         'Enable the editing options.
    DlgProc = 1            'Don't close the dialog box.
  End If
End Function
Sub Main()
  Begin Dialog OptionsTemplate 33,33,171,134,"Options",.DlgProc
    'Background (controls 0-5)
    GroupBox 8,40,152,84,""
    OptionGroup .WhichOptions
      OptionButton 8,8,59,8,"Save Options",.SaveOptions
      OptionButton 8,20,65,8,"Editing Options",.EditingOptions
    OKButton 116,7,44,14
    CancelButton 116,24,44,14
    'Save options (controls 6-8)
    CheckBox 20,56,88,8,"Always create backup",.CheckBox1
    CheckBox 20,68,65,8,"Automatic save",.CheckBox2
    CheckBox 20,80,70,8,"Allow overwriting",.CheckBox3
    'Editing options (controls 9-13)
    CheckBox 20,56,65,8,"Overtype mode",.OvertypeMode
    CheckBox 20,68,69,8,"Uppercase only",.UppercaseOnly
    CheckBox 20,80,105,8,"Automatically check syntax",.AutoCheckSyntax
    CheckBox 20,92,73,8,"Full line selection",.FullLineSelection
    CheckBox 20,104,102,8,"Typing replaces selection",.TypingReplacesText
  End Dialog
  Dim OptionsDialog As OptionsTemplate
  Dialog OptionsDialog
End Sub
See Also DlgControlId (function); DlgEnable (function); DlgEnable (statement); DlgFocus (function); DlgFocus (statement); DlgListBoxArray (function); DlgListBoxArray (statement); DlgSetPicture (statement); DlgText (statement); DlgText$ (function); DlgValue (statement); DlgValue (function); DlgVisible (statement).