DlgValue, DlgValue()

DlgValue Identifier, Value

DlgValue(Identifier)

 

The DlgValue statement is used in a dialog function to select or clear a dialog box control by setting the numeric value associated with the control specified by Identifier. For example, DlgValue "MyCheckBox", 1 selects a check box, DlgValue "MyCHeckBox", 0 clears a check box, and DlgValue "MyCheckBox", -1 fills the check box with gray. An error occurs if Identifier specifies a dialog box control such as a text box or an option button that cannot be set with a numeric value.

The following dialog function uses a Select Case control structure to check the value of Action. The SuppValue is ignored in this function.

'This sample file outlines dialog capabilities, including nesting dialog boxes.

Sub Main

Begin Dialog UserDialog1 60,60, 260, 188, "3", .Enable

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

TextBox 8, 26, 160, 18, .FText

CheckBox 8, 56, 203, 16, "Check to display controls",. Chk1

GroupBox 8, 79, 230, 70, "This is a group box:", .Group

CheckBox 18,100,189,16, "Check to change button text", .Chk2

PushButton 18, 118, 159, 16, "File History", .History

OKButton 177, 8, 58, 21

CancelButton 177, 32, 58, 21

End Dialog

Dim Dlg1 As UserDialog1

x = Dialog( Dlg1 )

End Sub

 

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"

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

x = Dialog( Dlg2 )

End If

Case Else

End Select

Enable =1

End Function