Name
Choice
Synopsis
Choice is an interface that contains the methods common to user
interface components that allow the user to choose from several possible alternatives.
This interface is implemented by the full-screen List control and
by ChoiceGroup, which is an Item.
A Choice can operate in one of three different modes:
- EXCLUSIVE
Only one alternative can be selected. If the user selects one item from the set of offered alternatives, any item already selected is deselected. In this mode, the control behaves as (and is usually rendered to look like) a set of radio buttons.
- MULTIPLE
Any number of alternatives can be selected. Selecting one item from the list has no effect on the selected state of other entries. In this, the control behaves like a collection of check boxes.
- IMPLICIT
This mode is available only with the
Listcontrol. It allows only one item to be selected at any given time and is typically used to create a menu. The difference between this mode andEXCLUSIVE, apart from the visual differences, lies in the way in which selection changes are notified to application code. See the description of theListcontrol for details.
Each entry in a Choice consists of one or both of an image provided
in the form of an Image object and a text string. The image, if provided,
is rendered in addition to any icon, such as a check box or radio button, supplied by the control
itself.
The number of entries
can be obtained by calling the size() method. An entry is distinguished by its index, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access