Lists of selectable items can be created with the
list-panel
class. Here is a simple example of a list panel:
(setq list
(make-instance 'list-panel
:items '(one two three four)
:visible-min-height '(character 2)
:print-function 'string-capitalize))
(contain list)
Notice how the items in the list panel are passed as symbols, and a print-function is specified which controls how those items are displayed on the screen.
Any item on the list can be selected by clicking on it with the mouse.
By default, list panels are single selection -- that is, only one item in the list may be selected at once. You can use the
:interaction
keyword to change this:
(make-instance 'list-panel
:items (list "One" "Two" "Three" "Four")
:interaction :multiple-selection)
(contain *)
You can add callbacks to any items in the list using the
:
selection-callback
keyword.
(make-instance 'list-panel
:items (list "One" "Two" "Three" "Four")
:selection-callback 'test-callback)
(contain *)