OptionGroup

Syntax

OptionGroup .Identifier

Remarks

Defines a series of related option buttons in a dialog box definition. An OptionGroup instruction is required for each series of related OptionButton instructions, which must be positioned directly following the OptionGroup instruction. Within the group, only one option button can be selected at a time. The OptionGroup identifier returns a value corresponding to the selected option button.

Argument

Explanation

.Identifier

Together with the dialog record name, .Identifier creates a variable whose value corresponds to the selected option button, where
0 (zero) is the first option button in the group, 1 is the second, and
so on. The form for this variable is DialogRecord.Identifier (for example, dlg.Brk).

The identifier string (.Identifier minus the period) is also used by statements in a dialog function that act on the option group, such as DlgEnable and DlgVisible.


Example

This macro creates the dialog box shown following it and then inserts either a page break or column break according to the option button the user selects. The identifier defined for the option group is .Brk. Note how the second If instruction performs an action based on the value of the dlg.Brk variable.


Sub MAIN
Begin Dialog UserDialog 292, 78, "Example"
    OKButton 188, 14, 88, 21
    CancelButton 188, 38, 88, 21
    GroupBox 12, 6, 164, 60, "Break"
    OptionGroup .Brk
        OptionButton 22, 23, 117, 16, "&Page Break"
        OptionButton 22, 41, 133, 16, "&Column Break"
End Dialog
Dim dlg As UserDialog
If Dialog(dlg) Then
    If dlg.Brk = 0 Then InsertPageBreak Else InsertBreak .Type = 1
End If
End Sub

See Also

Begin Dialog¼End Dialog, GroupBox, ListBox, OptionButton