Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
ListChooser
Last updated at 10:39 pm UTC on 4 December 2021
I am a simple dialog to allow the user to pick from a list of strings or symbols.
I support keyboard and mouse navigation, and interactive filtering of the displayed items.

You can specify whether you want the index, or the value of the selected item. If you're interested in the value, you can also allow users to Add a new value not in the list.

cmd-s or <enter> or double-click answers the currently selected item's value/index;
cmd-l or <escape> or closing the window answers nil/zero.

The dialog is implemented using ToolBuilder.

For an explanation how the ListChooser dialog code works see ListChooser buildWith: builder.

Example
 ListChooser chooseItemFrom: #(red green blue yellow black white) title: 'Pick a color'

More examples on the class side.

ListChooser_Pick_a_color_2018.png