Purpose |
Set the Check State for an OPTION (radio) control, and unset the Check State for other OPTION buttons in a group. |
Syntax |
CONTROL SET OPTION hDlg, id&, minid&, maxid& |
Remarks |
The Check State is deemed set (checked) when the check box is selected, and unset (unchecked or clear) if the check box is empty. Only one OPTION control in a group of OPTION controls should ever have its Check State set at any given time. OPTION controls in a group should be assigned unique sequential identifier numbers. hDlg refers to the dialog that owns the OPTION controls. id& is the unique control identifier as assigned to the button control with a CONTROL ADD OPTION statement. CONTROL SET OPTION sets the Check State for this control, and unsets the Check State for all of the remaining OPTION controls whose identifiers are included in the range minid& through maxid&, inclusive. The first OPTION control in a group should have the style %WS_GROUP to mark the beginning of a group of buttons, and the first non-OPTION control after the group should also have this style set. If there are no other controls after the group, add %WS_GROUP to the first control in the dialog. This ensures keyboard navigation with the arrow buttons will operate within the group of OPTION controls. |
See also |
|
Example |
#INCLUDE "DDT.INC" %OPT1 = 101 %OPT2 = 102 %OPT3 = 103 %OPT4 = 104 %OPT5 = 105
FUNCTION PBMAIN DIM hDlg AS DWORD DIALOG NEW 0, "OPTION control test", , ,100, 100, _ %WS_SYSMENU OR %WS_CAPTION TO hDlg CONTROL ADD OPTION, hDlg, %OPT1, "Option 1", 10, 6, 50, 14, _ %WS_GROUP OR %WS_TABSTOP CONTROL ADD OPTION, hDlg, %OPT2, "Option 2", 10, 20, 50, 14 CONTROL ADD OPTION, hDlg, %OPT3, "Option 3", 10, 34, 50, 14 CONTROL ADD OPTION, hDlg, %OPT4, "Option 4", 10, 48, 50, 14 CONTROL ADD OPTION, hDlg, %OPT5, "Option 5", 10, 62, 50, 14 CONTROL ADD BUTTON, hDlg, %IDOK, "OK", 25, 80, 50, 14, _ %WS_GROUP OR %WS_TABSTOP
' Set the initial state to OPTION button 3 CONTROL SET OPTION hDlg, %OPT3, %OPT1, %OPT5
DIALOG SHOW MODAL hDlg END FUNCTION |