Like buttons, individual menu items, menus, and menu-components can be disabled by setting the
:enabled
initarg to
nil
.
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*
between
t
and
nil
in the listener, using
setq
, results in the menu item toggling between an enabled and disabled state.