LispWorks CAPI User Guide > 8 Creating Menus

NextPrevUpTopContentsIndex

8.4 The CAPI menu hierarchy

The combination of menu items, menu components and menus can create a hierarchical structure as shown schematically in A schematic example of a menu hierarchy and graphically in An example of a menu hierarchy. This menu has five elements, one of which is itself a menu (with three menu items) and the remainder are menu components and menu items. Items in a menu inherit values from their parent, allowing similar elements to share relevant properties whenever possible.

(defun menu-item-name (data)
  (format nil "Menu Item ~D" data))
 
(defun submenu-item-name (data)
  (format nil "Submenu Item ~D" data))
 
(contain 
 (make-instance
  'menu 
  :items 
  (list
   (make-instance 'menu-component
                  :items '(1 2)
                  :print-function 'menu-item-name
                  )
   (make-instance 'menu-component
                  :items 
                  (list 3 
                        (make-instance 
                         'menu
                         :title "Submenu"
                         :items '(1 2 3)
                         :print-function
                         'submenu-item-name))
                  :print-function 'menu-item-name)
   (make-instance 'menu-item
                  :data 42))
  :print-function 'menu-item-name))

Figure 8.5 A schematic example of a menu hierarchy

Figure 8.6 An example of a menu hierarchy


LispWorks CAPI User Guide (Unix version) - 22 Dec 2009

NextPrevUpTopContentsIndex