6 Creating Menus

6.5 Disabling menu items

Like buttons, individual menu items, menus, and menu-components can be disabled by setting the:enabled keyword tonil.

In addition, a function can be specified via the:enabled-function keyword, that determines whether or not the menu, menu item, or menu component is enabled. Consider the following example:

(defvar *on* t)

(setq menu (make-instance 'menu-item :title "Foo" :enabled-function #'(lambda (menu) *on*)))

(contain menu)

Toggling the value of*on* betweent andnil in the listener, usingsetq, results in the menu item toggling between an enabled and disabled state.


CAPI User Guide, Liquid Common Lisp Version 5.0 - 2 OCT 1997

Generated with Harlequin WebMaker