Next Prev Up Top Contents Index

menu-object

Class
Summary

The class menu-object is the superclass of all menu objects, and provides functionality for handling generic aspects of menus, menu components and menu items.

Superclasses

callbacks

Subclasses

titled-menu-object

Slots

enabled

If nil , the menu object is disabled, and cannot be selected.

popup-callback

Callback before the menu appears.

enabled-function

Returns non- nil if the menu is enabled.

enabled-slot

The object is enabled if the slot is non- nil.

callback

The selection callback for the object.

callback-data-function

A function to return data for the callback.

Accessors

menu-object-enabled
menu-popup-callback

Description

When the menu object is about to appear on the screen, the CAPI does the following:

  1. The popup-callback (if there is one) is called with the menu object and it is allowed to make arbitrary changes to that object.
  2. The enabled function (if there is one) is called with the interface, and it should return non- nil if the menu object is enabled.
  3. The menu containing the object appears with all of the changes made.

Note that enabled-slot is a short-hand means of creating an enabled-function which checks the value of a slot in the menu object's interface.

The callback initarg is placed in the selection-callback , extend-callback and retract-callback slots unless these are given explicitly, and so will get called when the menu object is selected or deselected. The callback-data-function is a function that is called with no arguments and the value it returns is used as the data to the callbacks.

Example
(capi:contain (make-instance
               'capi:menu-item
               :text "Press Me"
               :enabled-function #'(lambda (item)
                                     (eq (random 2)
                                     1))))
See also

menu
menu-item
menu-component


LispWorks CAPI Reference Manual - 14 Dec 2001

Next Prev Up Top Contents Index