Rich UI RadioGroup
A Rich UI radioGroup widget (or, more simply, a radio group) displays a set of radio buttons, which are arranged horizontally. The group elicits a user click on any of the buttons and responds to the click by deselecting the group's previously selected radio button, if any.
If you specify the onClick event for the radio group, the user's click invokes a function. The same function is invoked in response to a click on any button; and in the typical case, the function first determines which button was clicked and then responds to the selection.
Here is example code:
import egl.ui.rui.Event;
import com.ibm.egl.rui.widgets.RadioGroup;
import com.ibm.egl.rui.widgets.TextField;
handler MyHandler type RUIHandler{initialUI =[myTextField, myRadioGroup]}
myTextField TextField{text = "On Monday?"};
myRadioGroup RadioGroup{groupName = "abc",
options =["Monday", "Tuesday"],
onClick ::= myRadio};
function myRadio(e Event in)
if(myRadioGroup.selected == "Tuesday")
myTextField.text = "No, on Monday!";
else
myTextField.text = "No, on Tuesday!";
end
end
endThe following properties are supported:
- groupName, which takes a string representing the name of the radio group, as needed by some browsers. This property is required.
- options, which refers to an array of strings that are displayed as the text of a set of radio buttons, one string per button
- selected, which is a field that can be accessed at run time, as shown in the example
Other supported properties and functions are described in “Widget properties and functions.”
Use of this widget requires the following statement:
import com.ibm.egl.rui.widgets.RadioGroup;