ListPicker

ListPicker[list, {val1, val2, ...}]
represents a list pane with setting list that can contain possible values .

ListPicker[Dynamic[list], {val1, ...}]
takes the setting to be the dynamically updated current value of list, with members added or removed each time an item is selected or deselected.

ListPicker[list, {val1->lbl1, val2->lbl2, ...}]
represents a list pane in which the possible value is indicated by .

Details and OptionsDetails and Options

  • ListPicker displays as a vertical list of items. By default, it displays using the default system appearance of a list box or list view.
  • Holding the Shift key while clicking on a ListPicker will add a range of items to the selection. Holding the Ctrl or Command key will toggle the selection of an individual item.
  • list contains all of the selected values. If no values are selected, then list will be an empty list.
  • The and can be strings, boxes, graphics, or any other expressions, including dynamic expressions.
  • Delimiter can be used in the list of to specify a horizontal delimiter in the displayed list pane.
  • The following options can be given:
  • AppearanceAutomaticthe overall appearance of the pane
    AppearanceElementsAutomaticoverall control elements to include in the displayed output
    BackgroundAutomaticbackground color to use
    BaselinePositionAutomaticalignment relative to surrounding text
    BaseStyle{}base style specifications for the pane
    ContentPaddingTruewhether to shrink the margins tightly around the contents
    EnabledAutomaticwhether the pane is enabled or grayed out
    FieldSize{{1.,50.},{1.,10.}}
  • the size of the field for list items
  • FrameMarginsAutomaticmargins to leave inside the menu frame
    ImageMargins0margins around the displayed menu
    ImageSizeAutomaticthe overall image size of the displayed list pane
    MultiselectionTruewhether to allow simultaneous selection of multiple items
    ScrollbarsAutomaticwhether to include scrollbars
    ScrollPosition{0,0}scroll position if scrolling is enabled
    SpacingsAutomaticvertical spacings
  • The settings for Background can be given as follows to apply separately to successive items in the control:
  • {s1,s2,...,sn}use through , then use defaults
    {{c}}use c in all cases
    {{c1,c2}}alternate between and
    {{c1,c2,...}}cycle through all
    {s,{c}}use s, then repeatedly use c
    {s1,{c},sn}use , then repeatedly use c, but use at the end
    {s1,s2,...,{c1, c2, ... }, sm, ... , sn}
    use the first sequence of at the beginning, then cyclically use the , then use the last sequence of at the end
    {s1,s2,...,{},sm,...,sn}use the first sequence of at the beginning and the last sequence at the end
    {i1->v1,i2->v2,...}specify what to use at positions
    {spec,rules}use rules to override specifications in spec
  • With settings of the form , if there are more specified than items across the list picker, from the beginning are used for the first items, and ones from the end are used for the last items.
  • Possible settings for Appearance include and .
  • Possible elements for AppearanceElements include .
  • The BaselinePosition is by default taken to be Center->Axis.
  • The settings for BaseStyle are appended to the default style typically given by the style in the current stylesheet.

ExamplesExamplesopen allclose all

Basic Examples (3)Basic Examples (3)

Select values from a list pane:

In[1]:=
Click for copyable input
Out[1]=

Initialize given values to be selected:

In[1]:=
Click for copyable input
Out[1]=

Connect ListPicker to a dynamic state:

In[1]:=
Click for copyable input
Out[1]=
New in 9
New to Mathematica? Find your learning path »
Have a question? Ask support »