Option Buttons and Group Boxes

You can have option buttons to allow the user to choose one option from several. Typically, you would use a group box to surround a group of option buttons, but you can also use a group box to set off a group of check boxes or any related group of controls.

Example 1

Sub Main

Begin Dialog GroupSample 31,32,185,96,"Option Button and Check Box"

OKButton 28,68,40,14

CancelButton 120,68,40,14

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

GroupBox 100,12,72,48,"GroupBox",.GroupBox2

OptionGroup .OptionGroup1

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

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

CheckBox 108,24,45,8,"CheckBox",.CheckBox1

CheckBox 108,40,45,8,"CheckBox",.CheckBox2

End Dialog

Dim Dlg1 As GroupSample

Button = Dialog (Dlg1)

End Sub

 

Example 2

Sub Main

Begin Dialog DialogName1 60, 60, 160, 70, "Text Box and Check Box"

Text 10, 10, 28, 12, "Name:"

TextBox 42, 10, 108, 12, .nameStr

TextBox 42, 24, 108, 12, .descStr

CheckBox 42, 38, 48, 12, "&CHECKME", .checkInt

OKButton 42, 54, 40, 12

Text 2,22,44,12, "Description:"

End Dialog

Dim Dlg1 As DialogName1

Dialog Dlg1

MsgBox Dlg1.nameStr

MsgBox Dlg1.descStr

MsgBox Dlg1.checkInt

End Sub