lcdui.choicegroup — Creates a group of potential choices that can be added to a form.
Choicegroups also utilize the common "item" options, described here: lcdui item options
The lcdui.choicegroup command creates a
"ChoiceGroup" widget that can be added to a form. A
ChoiceGroup is a list of options that can be selected.
ChoiceGroups come in three forms: radio buttons (the
exclusive type), where only one at a time
may be selected, check boxes (the
multiple type), or as a popup. (check
boxes). For an in-depth look at the Java code that this
command is based on, see:
The options describing the choicegroup are as follows:
-label: Labels the choicegroup
with the supplied text.
-type: Determines the type of the
chiocegroup, which can be one of
multiple (check boxes),
exclusive (radio buttons), or a
-fit: Specifies the type of
that the application has no preferences and that the
default can be used. The
means that text wrapping should be performed to fit
long lines. The
off option means
that text wrapping should not be performed and that
long lines will be truncated, and there should be some
indication of this truncation such as an ellipsis.
The lcdui.choicegroup command returns an object that is itself a command, and can be called with several subcommands:
append: Appends the given text to the choicegroup as one of the possible selections. Optionally, an image (as generated by lcdui.image may also be specified.
delete: Deletes the item
deleteall: Deletes all items in the given choicegroup.
insert: Inserts the given text,
and optional image at
itemcget: Given an item and an
which can be one of
-selected, returns the requested
1 if the item is selected, 0 if it isn't.
itemconfigure: Instead of returning information about the options listed above, sets the specified option for the given item.
selection: Used with a subcommand of its own, which can be one of:
get: Returns a list of integers indicating which elements are selected.
gettext: Returns the text of the selected element.
set: Selects the specified item.
clear: Clears the selection
from the given item, or, if no
itemnum is given,
clears all selected items.
size: Returns the number of elements in the choicegroup.
set choicegroup [lcdui.choicegroup -label "60ies bands"] $choicegroup append "Beatles" $choicegroup append "Beach Boys" $choicegroup append "Rolling Stones" set form [lcdui.form -title "ChoiceGroup example form"] $form append "Pick one:" $form append $choicegroup $form setcurrent
Live example: http://www.heclbuilder.com/scripts/show/143