1 CAPI Reference Entries
menu
creates a menu for an interface when specified as part of the menu bar (or as a submenu of a menu on the menu bar).
element
titled-menu-object
items
items-function
A function to dynamically compute the items.
menu-items
item
slot, but if you need to compute the items dynamically you should provide anitems-function
. This function gets called with the menu, and it should return a list of menu items for the new menu. This function is called before thepopup-callback
and theenabled-function
which means that they can affect the new items.
contain
will do just that for you.
(capi:contain (make-instance 'capi:menu :title "Test" :items '(:red :green :blue))) (capi:contain (make-instance 'capi:menu :title "Test" :items '(:red :green :blue) :print-function 'string-capitalize))(capi:contain (make-instance 'capi:menu :title "Test" :items '(:red :green :blue) :print-function 'string-capitalize :callback #'(lambda (data interface) (capi:display-message "Pressed ~S" data))))
(setq submenu (make-instance 'capi:menu :title "Submenu..." :items '(1 2 3)))(capi:contain (make-instance 'capi:menu :title "Test" :items (list submenu)))
items-function
:
(capi:contain (make-instance 'capi:menu :title "Test" :items-function #'(lambda (menu) (loop for i below 8 collect (random 10) ))))
capi/elements/menus.lisp
menu-component
menu-item
menu-object
contain
Generated with Harlequin WebMaker