Radio buttons and group boxes

<< Click to Display Table of Contents >>

Radio buttons and group boxes

You use radio buttons (also called "option buttons") if you want to allow the user to choose from more than one option, but allow him or her to pick only one of them.

Radio buttons that belong together are usually put inside a group box. You can also use group boxes to visually group together any other type of dialog controls.

dialog_radiogroup

Syntax:

 OptionButton X, Y, Width, Height, Text, .ID1

 OptionGroup .ID2

ID1 is a variable that contains the current state of the field.

ID2 is a variable that contains the index of the currently selected option.

Example:

Sub Main

 Begin Dialog GroupSample 31, 32, 185, 96, "Radio buttons and group boxes"

         OKButton 28, 68, 40, 14

         CancelButton 120, 68, 40, 14

         GroupBox 12, 8, 72, 52, "Group box", .GroupBox1

         GroupBox 100, 8, 72, 52, "Group box", .GroupBox2

         OptionGroup .OptionGroup1

         OptionButton 16, 24, 54, 8, "Radio button", .OptionButton1

         OptionButton 16, 40, 54, 8, "Radio button", .OptionButton2

         CheckBox 108, 24, 50, 8, "Check box", .CheckBox1

         CheckBox 108, 40, 50, 8, "Check box", .CheckBox2

 End Dialog

 Dim Dlg1 As GroupSample

 Button = Dialog (Dlg1)

End Sub