GUI ScreenIO for Windows

 ScreenIO.com


How to Use Radiobutton Controls in Your Program

The field definition of a radiobutton, like a checkbox, consists of a simple PIC 9 area, and an 88-level for its two possible values: ON or OFF:

 01 panel-4.
      .    
      .
     05 MY-RADIOBUTTON-A PIC 9   VALUE 0.
       88 MY-RADIOBUTTON-A-ON    VALUE 1.
       88 MY-RADIOBUTTON-A-OFF   VALUE 0.

It's very simple to set the state of a radiobutton using the 88-level values:

To set the state of a radiobutton to ON (checked):

     SET MY-RADIOBUTTON-A-ON TO TRUE.

To set the state of a radiobutton to OFF (not checked):

     SET MY-RADIOBUTTON-A-OFF TO TRUE.

The next time you call GUI ScreenIO to display your panel, the radiobutton will show the value that you set in your program. 

If you attempted to check more than one radiobutton in a group, GUI ScreenIO will only check the last one when the panel is displayed.  That's because radiobuttons are mutually exclusive; only one radiobutton in a  group may be checked; all the rest will be unchecked.

When control returns from GUI ScreenIO, you test the state of the checkbox using the 88-level items, like this:

     EVALUATE TRUE

       WHEN MY-RADIOBUTTON-A-OFF
         PERFORM MY-RADIOBUTTON-OFF-ROUTINE

       WHEN MY-RADIOBUTTON-A-ON
         PERFORM MY-RADIOBUTTON-ON-ROUTINE

     END-EVALUATE

Or, if you prefer using IF statements:

     IF MY-RADIOBUTTON-A-OFF
       PERFORM MY-RADIOBUTTON-OFF-ROUTINE
     ELSE
       IF MY-RADIOBUTTON-A-ON
         PERFORM MY-RADIOBUTTON-ON-ROUTINE
       END-IF
     END-IF

Related topics:


© 2000-2019 Norcom, all rights reserved 

TOC

Send feedback to Norcom