You can create menus for an application using the menu class. For more control you can also use menu-component and menu-item.
menu, menu-component and menu-item all inherit from the callbacks class, which defines callbacks that are called when the user selects an item in the menu. They also inherit from the menu-object class, which adds some menu-specific callback functionality, title and enabling.
You should make sure you have defined the test-callback
and hello
functions before attempting any of the examples in this chapter. Their definitions are repeated here for convenience.
(defun test-callback (data interface)
(display-message "Data ~S in interface ~S"
data interface))
(defun hello (data interface)
(declare (ignore data interface))
(display-message "Hello World"))
The menus in the menu bar of a window are defined by the :menu-bar
of the interface. See define-interface, the interface initarg :menu-bar-items
, and Adding menus. The macro define-interface allows you to define menus by specifying the arguments that you would pass to cl:make-instance
if you made them explicitly. The actual menus in the menu bar have the properties described in this chapter.
CAPI User Guide and Reference Manual (Macintosh version) - 3 Aug 2017