Release 10.1A: OpenEdge Development:
Progress 4GL Handbook

> ## Using a radio set to display a set of choices for a value

> In this section, you’ll look at the radio set as a representative example of the ways you can display a list of values. You can find out more about each object type’s individual attributes in the online Help and OpenEdge Development: Progress 4GL Reference .

> The term radio set derives from the preset radio station buttons found on most car radios. The radio set is an appropriate visualization when you want to make it clear that the user must choose one value at the expense of others, when making one choice automatically cancels any other choice. Even though making a single choice from a list naturally results in not choosing another value, the radio set is appropriate when the choices are somehow related, and when the user should consider the list and think about the effect of choosing one value over another. You also need to lay out a radio set carefully when you’re designing a window, making room in either a vertical or a horizontal format for the radio buttons themselves and their labels. A radio set is appropriate when the number of values is fixed and not likely to change. So, for example, a list of possible Sales Reps wouldn’t be an appropriate field to display as a radio set, because the number of values in the list could change over time and also because Sales Rep initials are just alternative data values without a relationship to one another, which would make it necessary to consider one choice versus another.

> | To add a radio set to your test window:

> 1. Click the Radio Set icon from the AppBuilder Palette:

> 2. Drop it onto the design window to the right of the navigation buttons.

> You’re going to use the radio set to allow the user to selectively enable or disable different combinations of navigation buttons.

> 3. Double-click on the radio set to go into its property sheet. Name it iAllowNav.

> When you define the list of choices for a radio set, you must specify both the radio button label to display and the associated value you want to assign to the field when that button is chosen. If the labels and values are the same, you have to specify each one as both the label and the value. Because you can assign any field value you want for a radio button choice, you can define a radio set as representing any of the standard data types `CHARACTER`, `DECIMAL`, `INTEGER`, `DATE`, and `LOGICAL`.

> 4. In the property sheet, select INTEGER as the data type and enter the button labels and values shown here:

> 5. Click the Advanced button and set the initial value of the radio set to 3.

> This makes the Allow All choice the initial value, which is appropriate because all the buttons are initially enabled.

> Now you have to define the trigger code to enable and disable buttons when the user makes a choice.

> 6. Define this `VALUE-CHANGED` trigger for the radio set:

>     DO:
>       ASSIGN iAllowNav.
>       IF iAllowNav = 1 THEN
>           ASSIGN BtnFirst:SENSITIVE = NO
>                  BtnLast:SENSITIVE  = NO.
>       ELSE IF iAllowNav = 2 THEN
>           ASSIGN BtnPrev:SENSITIVE = NO.
>       ELSE ASSIGN BtnFirst:SENSITIVE = YES
>                   BtnLast:SENSITIVE = YES
>                   BtnPrev:SENSITIVE = YES.
>     END.

> 7. Use the mouse to adjust the size of the radio set in the design window so that the labels all display correctly.

> 8. Run the window again and try out the different radio set choices:

> This is the code the AppBuilder generated to display the radio set:

>     DEFINE VARIABLE iAllowNav AS INTEGER INITIAL 3
>          VIEW-AS RADIO-SET VERTICAL
>          RADIO-BUTTONS
>               "No First/Last", 1,
>               "No Prev", 2,
>               "Allow All", 3
>          SIZE 23 BY 2.38 NO-UNDO.

Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095