Statement or Function |
Action or Result |
DlgControlId |
Returns the numeric equivalent of Identifier$, the string identifier for a dialog box control. |
DlgEnable, DlgEnable() |
The DlgEnable statement is used to enable or disable a dialog box control. When a control is disabled, it is visible in the dialog box, but is dimmed and not functional. DlgEnable() is used to determine whether or not the control is enabled. |
DlgFocus, DlgFocus() |
The DlgFocus statement is used to set the focus on a dialog box control. (When a dialog box control has the focus, it is highlighted.) DlgFocus() returns the identifier of the control that has the focus. |
DlgListBoxArray, DlgListBoxArray() |
The DlgListBoxArray statement is used to fill a list box or combo box with the elements of an array. It can be used to change the contents of a list box or combo box while the dialog box is displayed. DlgListBoxArray() returns an item in an array and the number of items in the array. |
DlgSetPicture |
The DlgSetPicture statement is used in a dialog function to set the graphic displayed by a picture control. |
DlgText, DlgText |
The DlgText statement is used to set the text or text label for a dialog box control. TheDlgText() function returns the label of a control. |
DlgValue, DlgValue() |
The DlgValue statement is used to select or clear a dialog box control. Then DlgValue() function returns the setting of a control. |
DlgVisible, DlgVisible() |
The DlgVisible statement is used to hide or show a dialog box control. The DlgVisible() function is used to determine whether a control is visible or hidden. |
DlgControlId function
DlgControlId(Identifier)
Used within a dialog function to return the numeric identifier for the dialog box control specified by Identifier, the string identifier of the dialog box control. Numeric identifiers are numbers, starting at 0 (zero) , that correspond to the positions of the dialog box control instructions within a dialog box definition. For example, consider the following instruction in a dialog box definition:
CheckBox 90, 50, 30, 12, “&Update”, .MyCheckBox
The instruction DlgControlId(“MyCheckBox”) returns 0 (zero) if the CheckBox instruction is the first instruction in the dialog box definition, 1 if it is the second, and so on.
In most cases, your dialog functions will perform actions based on the string identifier of the control that was selected.
DlgFocus Statement, DlgFocus() Function
DlgFocus Identifier
DlgFocus()
The DlgFocus statement is used within a dialog function to set the focus on the dialog box control identified by Identifier while the dialog box is displayed. When a dialog box control has the focus, it is active and responds to keyboard input. For example, if a text box has the focus, any text you type appears in that text box.
The DlgFocus() function returns the string identifier for the dialog box control that currently has the focus.
Example:
This example sets the focus on the control “MyControl1” when the dialog box is initially displayed. (The main subroutine that contains the dialog box definition is not shown.)
Function MyDlgFunction( identifier, action, suppvalue)
Select Case action
Case 1 ‘ The dialog box is displayed
DlgFocus “MyControl1”
Case 2
‘ Statements that perform actions based on which control is selected
End Select
End Function
DlgListBoxArray, DlgListBoxArray()
DlgListBoxArray Identifier, ArrayVariable()
DlgListBoxArray(Identifier, ArrayVariable())
The DlgListBoxArray statement is used within a dialog function to fill a ListBox, DropListBox, or ComboBox with the contents of ArrayVariable() while the dialog box is displayed.
The DlgListBoxArray() function fills ArrayVariable() with the contents of the ListBox, DropListBox, or ComboBox specified by Identifier and returns the number of entries in the ListBox, DropListBox, or ComboBox. The ArrayVariable() parameter is optional (and currently not implemented) with the DlgListBoxArray() function; if ArrayVariable() is omitted, DlgListBoxArray() returns the number of entries in the specified control.
DlgSetPicture
DlgSetPicture Identifier, PictureName
The DlgSetPicture function is used to set the graphic displayed by a picture control in a dialog.
The Identifier is a string or numeric representing the dialog box. The PictureName is a string that identifies the picture to be displayed.
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