Name

lcdui.list — Creates a full-screen list

Synopsis

lcdui.list [-title title] [-type exclusive | multiple | implicit ] [-selectcommand cmd]

Description

The lcdui.list command creates a full-screen list and returns a command/object that can be used to manipulate it. For an in-depth look at the Java code that this command is based on, see: javax.microedition.lcdui.List

The options unique to this command are as follows:

  • -type: One of exclusive, multiple or implicit. Exclusive and multiple correspond, respectively, to radio buttons and checkboxes. Implicit lists act like a menu, dispatching to the list's -commandaction when a list item is selected.

  • -selectcommand: Select the command which should be used for implicit list select actions.

Example

set selectcmd [lcdui.command -label Select -longlabel Select -type \
    item -priority 1]
set lst [lcdui.list -title "List Example" -commandaction selectname]
set names {Anna Barbara Carla Daniela Emanuela Federica}
foreach n $names {
    $lst append $n
}
$lst setcurrent
$lst addcommand $selectcmd
proc selectname {cmd lst} {
    global names
    [lcdui.alert -text "Selected: [lindex $names [$lst selection get]]"] \
        setcurrent
}

Produces:

Live example: http://www.heclbuilder.com/scripts/show/151