Using Intel® Visual Fortran to Create and Build Windows*-Based Applications

ID 757211
Date 7/23/2021
Public
Document Table of Contents

Using Check Boxes and Radio Buttons

Check boxes and Radio buttons present the user with an either-or choice. A Radio button is pushed or not, and a Check box is checked or not. You use DLGGET or DLGGETLOG to check the state of these controls. Their state is a logical value that is .TRUE. if they are pushed or checked, and .FALSE. if they are not. For example:

  LOGICAL pushed_state, checked_state, retlog
  retlog = DLGGET (dlg, IDC_RADIOBUTTON1, pushed_state)
  retlog = DLGGET (dlg, IDC_CHECKBOX1, checked_state)

If you need to change the state of the button, for initialization or in response to other user input, you use DLGSET or DLGSETLOG. For example:

  LOGICAL retlog
  retlog = DLGSET (dlg, IDC_RADIOBUTTON1, .TRUE.)
  retlog = DLGSET (dlg, IDC_CHECKBOX1, .TRUE.)

Radio buttons are typically used in a group where the user can select only one of a set of options. When using Radio buttons with the Dialog routines, use the following guidelines:

  • Each Radio button should have the "Auto" style set. This is the default for a new Radio button.

  • The first Radio button in a group should have the "Group" style set. This is not the default for a new Radio button.

  • The remaining Radio buttons in the group should not have the "Group" style set, and should immediately follow the first button in the dialog box "Tab order." The default tab order is the order in which you create the controls. You can view and change the tab order from the Format>Tab Order menu option in the Resource Editor.

  • When the user selects a Radio button in a group, its state is set to .TRUE. and the state of the other Radio buttons in the group is set to .FALSE..

  • To set the currently selected Radio button from your code, call DLGSETLOG to set the selected Radio button to .TRUE.. Do not set the other Radio buttons to .FALSE.. This is handled automatically.