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

NextPrevUpTopContentsIndex

menu-component

Class
Summary

The class menu-component is a choice that is used to group menu items and submenus both visually and functionally. The items contained by the menu-component appear separated from other items, menus, or menu components, by separators.

Package

capi

Superclasses

choice
titled-menu-object

Initargs

:items

The items to appear in the menu.

:items-function

A setup callback function to dynamically compute the items.

:selection-function

A setup callback function to dynamically compute the selection.

:selected-item-function

A setup callback function to dynamically compute the selected item.

:selected-items-function

A setup callback function to dynamically compute the selected items.

Description

Because menu-component is a choice, the component can have interaction :no-selection, :single-selection or :multiple-selection (extended selection does not apply here). This is represented visually in the menu as appropriate to the window system that the CAPI is running on (by ticks in Microsoft Windows, and by radio buttons and check buttons in Motif).

Note that it is not appropriate to have menu components or submenus inside :single-selection and :multiple-selection components, but it is OK in :no-selection components.

items and items-function behave as in menu.

No more than one of selection-function , selected-item-function and selected-items-function should be non-nil. Each defaults to nil. If one of these setup callbacks is supplied, it should be a function which is called before the menu-component is displayed and which determines which items are selected. By default the setup callback is called on the interface of the menu-component, but this argument can be changed by passing the menu-object initarg setup-callback-argument .

selection-function , if non-nil, should return a value which is suitable for passing to the choice accessor (setf choice-selection). This will be nil, or a single index (for interaction :single-selection), or a list of item indices (for interaction :multiple-selection and :extended-selection).

selected-item-function , if non-nil, should return an object which is an item in the menu-component, or is equal to such an item when compared by the menu-component's test-function .

selected-items-function , if non-nil, should return a list of such objects.

Example
(capi:contain (make-instance 
              'capi:menu-component
              :items '(:red :green :blue)
              :print-function 'string-capitalize
              :interaction :single-selection))
(capi:contain (make-instance
               'capi:menu-component
               :items '(:red :green :blue)
               :print-function 'string-capitalize
               :interaction :multiple-selection))
(capi:contain (make-instance
               'capi:menu
               :items (list
                       "An Item"
                       (make-instance 
                        'capi:menu-component
                        :items '(:red :green :blue)
                        :print-function
                         'string-capitalize
                        :interaction :no-selection)
                        "Another Item")))
See also

menu
menu-item
CAPI elements
Choices - panes with items
Creating Menus


CAPI User Guide and Reference Manual (Unix version) - 25 Feb 2015

NextPrevUpTopContentsIndex