Examples

The following creates a simple radio button:

DISPLAY RADIO-BUTTON, "&Left Align",
HANDLE IN RADIO-BUTTON-1.

Frequently, you will want to create several radio buttons, each offering the user a different option. Here is a Screen Section entry that specifies three buttons:

01 ALIGNMENT-CHOICES.
    03  RADIO-BUTTON, "&Left", USING ALIGN-CHOICE
        GROUP-VALUE 1.
    03  RADIO-BUTTON, "&Right", USING ALIGN-CHOICE
        LINE + 1.5
        GROUP-VALUE 2.
    03  RADIO-BUTTON, "&Center", USING ALIGN-CHOICE
        LINE + 1.5
        GROUP-VALUE 3.

In the preceding example, ALIGN-CHOICE is set to 1, 2, or 3 depending on which radio button is selected.

Here are the same buttons as they might appear in a toolbar. These buttons are bitmap buttons. Also, instead of storing their value, they simply notify the COBOL program when they have been pressed (via the EXCEPTION-VALUE). Like most toolbar buttons, they are self activating. This frees the COBOL program from having to explicitly ACCEPT the toolbar buttons.

01 TOOLBAR-CHOICES.
    03  RADIO-BUTTON, "Left", 
        NOTIFY, SELF-ACT
        BITMAP-NUMBER 1, EXCEPTION-VALUE 1.
    03  RADIO-BUTTON, "Right", OVERLAP-LEFT,
        NOTIFY, SELF-ACT,
        BITMAP-NUMBER 2, EXCEPTION-VALUE 2.
    03  RADIO-BUTTON, "Center", OVERLAP-LEFT,
        NOTIFY, SELF-ACT
        BITMAP-NUMBER 3, EXCEPTION-VALUE 3.

Several other examples of programming radio buttons can be found in the sample programs included with the release materials. These examples demonstrate a range of application, including use of the GROUP special property and bitmap buttons. Look in tour.cbl for a simple example. See radiobtn.cbl for a set of basic examples. See winspool.cbl for a more complex use of radio buttons.