How to hide a radio-button of a radio-set on run-time condition?

Reynold

Member
Hello All,

I just stuck on one issue to hide one of the radio-button among 3 radio-buttons of a radio-set on the basis of a run-time condition.

I mean - I defined a radio-set(rsXYZ) containing 3 radio-buttons("X",1, "Y",2, "Z",3). Now on the basis of one run-time condition, I want to hide one of the radio-button (say "Z",3).

Could anyone help me in this regard as I am not able to do that ... :(

Thanks in Advance.. :)
 

rzr

Member
You can try creating radio-buttons dynamically at runtime... i've not tried it before so cannot quote example...
or you could go the dirty way: define another radio-button(s) with only one entry. And at runtime, enable/disable the widgets as per your logic.
 

rzr

Member
maybe this "might" help you..

Code:
[FONT=courier new]DEFINE VARIABLE hRadioSet AS HANDLE      NO-UNDO.
DEFINE FRAME MyFrame WITH SIZE 70 BY 21.

RUN P_Create_RS.

ON 'VALUE-CHANGED':U OF hRadioSet
DO:
    hRadioSet:DELETE("Item 2") .
END.

ENABLE ALL WITH FRAME MyFrame.
WAIT-FOR "VALUE-CHANGED" OF hRadioSet.

PAUSE 1.
DELETE OBJECT hRadioSet.

ASSIGN hRadioSet = ?.

PROCEDURE P_Create_RS PRIVATE :

    CREATE RADIO-SET hRadioSet
        ASSIGN ROW    = (6.7)
        COLUMN        = (13.14)
        HEIGHT-CHARS  = 1
        WIDTH-CHARS   = 10.0
        FRAME         = FRAME MyFrame:HANDLE
        HORIZONTAL    = FALSE 
        BGCOLOR       = 8
        AUTO-RESIZE  = TRUE 
        .
    hRadioSet:ADD-LAST("Item 1", "1").
    hRadioSet:ADD-LAST("Item 2", "2").
    hRadioSet:ADD-LAST("Item 3", "3").

END PROCEDURE.
[/FONT]
 

Osborne

Active Member
I do not know if there is a clear all option. Something like this would work:
Code:
DEFINE VARIABLE i AS INT NO-UNDO.
DEFINE VARIABLE vRadioButtons AS CHAR EXTENT 3 INITIAL ["X","Y","Z"] NO-UNDO.

DO i = 1 TO EXTENT(vRadioButtons):
   rsXYZ:DELETE(vRadioButtons[i]).
END.
However, rather than doing this it would be better to disable or hide the radio buttons or as rzr posted create dynamically when required.
 

anandknr

Member
But thats require (rzr method) label value as input parameter for delete function....so is there any way get the label value of selected radio button...?????
I know handle:screen-value will give the key value, like that i am looking for label value so that i can use rzr method
 

Osborne

Active Member
Is this what you require:

ENTRY(LOOKUP(rsXYZ:SCREEN-VALUE,rsXYZ:RADIO-BUTTONS) - 1,rsXYZ:RADIO-BUTTONS).
 
Top