Get Text of radio buttons

nandanak

New Member
I have radio button set,
For Example Options : Red, Blue, Green

I need when I click Blue option, I want to get the Text of that option : Blue, Red for red option.

How can I do this ?
 

rzr

Member
Is your variable that defines the RADIO-SET of CHARACTER data type? If yes then you could set the radio set values as below:

Code:
[FONT=courier new]DEFINE VARIABLE RADIO-SET-1 AS CHARACTER [/FONT]
[FONT=courier new]     VIEW-AS RADIO-SET VERTICAL[/FONT]
[FONT=courier new]     RADIO-BUTTONS [/FONT]
[FONT=courier new]          "Red", "Red",[/FONT]
[FONT=courier new]          "Green", "Green",[/FONT]
[FONT=courier new]          "Blue", "Blue"[/FONT]
[FONT=courier new]     SIZE 12 BY 3 NO-UNDO.[/FONT]

and then

Code:
[FONT=courier new]ON VALUE-CHANGED OF RADIO-SET-1 IN FRAME DEFAULT-FRAME[/FONT]
[FONT=courier new]DO:[/FONT]
  
[FONT=courier new]    MESSAGE SELF:SCREEN-VALUE [/FONT][FONT=courier new]VIEW-AS ALERT-BOX INFO BUTTONS OK.[/FONT]
[FONT=courier new]END.[/FONT]
 

SergioC

Member
Hi, taking the above example.
Code:
DEFINE VARIABLE RADIO-SET-1 AS INTEGER
    VIEW-AS RADIO-SET VERTICAL
    RADIO-BUTTONS "Red", 1,
                  "Green", 2,
                  "Blue", 3
                  SIZE 12 BY 3 NO-UNDO.
 
UPDATE RADIO-SET-1.
 
DISPLAY radio-set-1:screen-value LABEL 'Value'
        entry(lookup(radio-set-1:screen-value,radio-set-1:radio-buttons) - 1,
              radio-set-1:radio-buttons) LABEL 'Label'
        with frame b.

Regards.
 
Top