All Manuals > CAPI User Guide and Reference Manual > 21 CAPI Reference Entries

choice-selected-items Accessor

Summary

Returns the currently selected items in a choice as a list of the items.

Package

capi

Signature

choice-selected-items choice => items

(setf choice-selected-items) items choice => items

Arguments
choice
A choice.
items
A list of items.
Values
items
A list of items.
Description

The accessor choice-selected-items accesses the currently selected items in a choice as a list of the items. A setf method is provided as a means of setting the currently selected items. Note that the items are compared by the test-function of choice - see collection for details.

In the case of :single-selection choices, it is usually easier to use the complementary function choice-selected-item, which returns the selected item as its result.

Examples

First we set up a :multiple-selection choice — in this case, a list panel.

(setq list (capi:contain
            (make-instance 
             'capi:list-panel 
             :items '(a b c d e)
             :visible-min-height '(:character 5)
             :interaction :multiple-selection
             :selection '(1 3))))

The following code line returns the selections of the list.

(capi:choice-selected-items list)

The selections of the list panel can be changed and redisplayed using the following code.

(capi:apply-in-pane-process
 list #'(setf capi:choice-selected-items) 
 '(a c e) list)
(capi:choice-selected-items list)

Note that interaction :multiple-selection is not supported for lists on macOS.

See also

choice
choice-selected-item
choice-selected-item-p
choice-selected-items
collection
5 Choices - panes with items


CAPI User Guide and Reference Manual (Windows version) - 01 Dec 2021 19:33:57