DlgEnable Statement

 

DlgEnable “ControlName”, Value

 

This statement is used to enable or disable a particular control on a dialog box.

 

The  parameter ControlName  is the name of the control on the dialog box.  The parameter Value  is the value to set it to. 1 = Enable, 0 = Disable. On is equal to 1 in the example below.  If the second parameter is omitted the status of the control toggles.  The entire example below can be found in the dialog section of this manual and in the example .bas files that ship with Cypress Enable.

 

 

Related Topics: DlgVisible, DlgText

 

 

Example:

 

Function Enable( ControlID$, Action%, SuppValue%)

Begin Dialog UserDialog2 160,160, 260, 188, "3", .Enable

   Text 8,10,73,13, "New dialog Label:"

   TextBox 8, 26, 160, 18, .FText

   CheckBox 8, 56, 203, 16, "New CheckBox",. ch1

   CheckBox 18,100,189,16, "Additional CheckBox", .ch2

   PushButton 18, 118, 159, 16, "Push Button", .but1

   OKButton 177, 8, 58, 21

   CancelButton 177, 32, 58, 21

 End Dialog

 

 Dim Dlg2 As UserDialog2

 Dlg2.FText = "Your default string goes here"

Select Case Action%

 

Case 1

   DlgEnable "Group", 0

   DlgVisible "Chk2", 0

   DlgVisible "History", 0

Case 2

   If ControlID$ = "Chk1" Then

             DlgEnable "Group", On

             DlgVisible "Chk2"

             DlgVisible "History"

   End If

 

   If ControlID$ = "Chk2" Then

             DlgText "History", "Push to display nested dialog"

   End If

 

   If ControlID$ = "History" Then

              Enable =1

                   Number = 4

              MsgBox SQR(Number) & " The sqr of 4 is 2"

              x = Dialog( Dlg2 )

   End If

  

   If ControlID$ = "but1" Then

                        

                     

   End If

 

Case Else

 

End Select

Enable =1

 

End Function