Use a radio set to display a set of choices for a value
- Last Updated: January 16, 2024
- 3 minute read
- OpenEdge
- Version 12.8
- Documentation
In this section, you 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 ABL 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 are 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 would not 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:
- Click the Radio Set icon from the AppBuilder Palette.
- Drop it onto the design window to the right of the navigation buttons.
You are going to use the radio set to allow the user to selectively enable or disable different combinations of navigation buttons.
- 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.
- In the property sheet, select INTEGER as the data type and
enter the button labels and values shown here:
- 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.
- Define this
VALUE-CHANGEDtrigger 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. - Use the mouse to adjust the size of the radio set in the design window so that the labels all display correctly.
- Run the window again and try out the different radio set
choices:
|