A RadioButton object represents a radio button. The RadioButton class is a subclass of BaseListItem, which is derived from BaseValueComponent. The class hierarchy for RadioButton is shown in Figure 2.17.
Table 2.14 shows the attribute defined in the BaseListItem class and Table 2.15 shows the attribute defined in RadioButton.
Name | Usage | Type | Default | Accessibility |
---|---|---|---|---|
onselected | Tag and JS | expression | null | read-write |
Description. Invoked when this item is selected. |
Name | Usage | Type | Default | Accessibility |
---|---|---|---|---|
text_y | Tag and JS | number | centered | read-write |
Description. The y position of the text label. |
No new methods are defined in BaseListItem and RadioButton.
The code in Listing 2.13 shows an LZX application that uses RadioButton. Note that you can create a RadioButton by using the radiobutton tag. The radiogroup tag is used to group radio buttons in the same selection.
<canvas height="150"> <radiogroup> <radiobutton text="Red"/> <radiobutton text="Green"/> <radiobutton text="Blue"/> </radiogroup> </canvas> |
You can invoke the code in Listing 2.13 using this URL:
http://localhost:8080/lps-4.0.x/app02/radioTest1.lzx
The generated output is shown in Figure 2.18.