All Manuals > CAPI User Guide > 9 Creating Menus

NextPrevUpTopContentsIndex

9.7 Disabling menu items

A function can be specified via the :enabled-function initarg, that determines whether or not the menu, menu item, or menu component is enabled. By default, a menu object is always enabled.

Consider the following example:

(defvar *on* nil)
 
(contain
 (make-instance 'menu
                :items
                (list 
                 (make-instance 
                 'menu-item
                 :title "Foo"
                 :enabled-function 
                 #'(lambda (menu) *on*))
                (make-instance 
                 'menu-item
                 :title "Bar"))))

Figure 9.7 A menu with a disabled menu item

Changing the value of *on* between t and nil in the Listener, using setq , results in the menu item changing between the enabled and disabled states.

9.7.1 Dialogs and disabled menu items


CAPI User Guide (Macintosh version) - 30 Aug 2011

NextPrevUpTopContentsIndex