NextPrevUpTopContentsIndex

list-panel

Class
Summary

The class list-panel is a pane that can display a group of items and provides support for selecting items and performing actions on them.

Package

capi

Superclasses

choice
simple-pane
sorted-object
titled-object

Subclasses

list-view
multi-column-list-panel

Initargs

:right-click-selection-behavior

A keyword or nil . Controls the behavior on a right mouse button click.

:color-function

A function designator or nil . Controls item text color on Microsoft Windows.

Accessors

list-panel-right-click-selection-behavior

Description

The class list-panel gains most of its behavior from choice, which is an abstract class that handles items and their selection. By default, a list panel has both horizontal and vertical scrollbars.

The list-panel class does not support the :no-selection interaction style. For a non-interactive list use a display-pane.

To scroll a list-panel , call scroll with scroll-operation :move .

mnemonic-title is interpreted as for menu.

right-click-selection-behavior can take the following values:

nil

Corresponds to the behavior in LispWorks 4.4 and earlier. The data is not passed.

All non- nil values pass the clicked item as data to the pane menu:

:existing-or-clicked/restore/discard

If the clicked item is not already selected, make it be the entire selection while the menu is displayed. If the clicked item is already selected, do not change the selection. If the menu is cancelled, the original selection is restored. If the user chooses an item from the menu, the selection is not restored.

:temporary-selection

A synonym for :existing-or-clicked/restore/discard .

:existing-or-clicked/restore/restore

If the clicked item is not already selected, make it be the entire selection while the menu is displayed. If the clicked item is already selected, do not change the selection. If the user chooses an item from the menu and the item's callback does not set the selection then the original selection is restored after the callback. If the callback sets the selection, then this selection remains. The original selection is restored if the user cancels the menu.

:temporary-restore

A synonym for :existing-or-clicked/restore/restore .

:clicked/restore/discard

Make the clicked item be the entire selection while the menu is displayed. If the menu is cancelled, the original selection is restored. If the user chooses an item from the menu, the selection is not restored.

:temporary-always

A synonym for :clicked/restore/discard .

:clicked/restore/restore

Make the clicked item be the entire selection while the menu is displayed. If the user chooses an item from the menu and the item's callback does not set the selection then the original selection is restored after the callback. If the callback sets the selection, then this selection remains. The original selection is restored if the user cancels the menu.

:existing-or-clicked/discard/discard

If the clicked item is not already selected, make it be the entire selection while the menu is displayed. If the clicked item is already selected, do not change the selection. The original selection is never restored, regardless of whether the user chooses an item from the menu or cancels the menu.

:discard-selection

A synonym for :existing-or-clicked/discard/discard .

:clicked/discard/discard

Make the clicked item be the entire selection. The original selection is never restored, regardless of whether the user chooses an item from the menu or cancels the menu.

:discard-always

A synonym for :clicked/discard/discard .

:no-change

Does not affect the selection, but the clicked item is nonetheless passed as the data.

The default value of right-click-selection-behavior is :no-change .

color-function allows you to control the text colors on Microsoft Windows. If color-function is non- nil , then it is a function used to compute the text color of each item, with signature

color-function list-panel item state => result

state must be a keyword representing the state of the item. It can be one of :normal , :selected or :disabled . The value result should be a value suitable for the function convert-color. The pane uses the converted color as the foreground color for the item item . color-function is called while list-panel is being drawn, so it should not do heavyweight computations.

Example
(setq list (capi:contain
            (make-instance 'capi:list-panel
                           :items '(:red :blue :green)
                           :selected-item :blue
                           :print-function
                           'string-capitalize)))
 
(capi:apply-in-pane-process 
 list #'(setf capi:choice-selected-item) :red list)
 
(capi:apply-in-pane-process 
 list #'(setf capi:choice-selected-item) :green list)
(capi:contain (make-instance
               'capi:list-panel
               :items '(:red :blue :green)
               :print-function 'string-capitalize
               :selection-callback
                 #'(lambda (data interface)
                           (capi:display-message
                            "~S" data))))

This example illustrates the use of :right-click-selection-behavior :

(capi:define-interface click ()
  ((keyword :initarg :right-click-selection-behavior))
  (:panes
   (list-panel
    capi:list-panel
    :items '("foo" "bar" "baz" "quux")
    :visible-min-height '(:character 4)
    :pane-menu 'my-menu
    :interaction :multiple-selection
    :right-click-selection-behavior keyword)))
 
(defun my-menu (pane data x y)
  (declare (ignore pane x y))
  (make-instance 'capi:menu
                 :items (list "Hi There"
                              ""
                              "Here's the data:"
                              data)))
 
(capi:display
   (make-instance 'click
                  :right-click-selection-behavior
		  :clicked/restore/restore))

See also the example in examples/capi/choice/list-pane-pane-menu.lisp .

There are further examples in the directory examples/capi/choice/ .

See also

button-panel


LispWorks CAPI Reference Manual - 17 Mar 2008

NextPrevUpTopContentsIndex