A menu can be created in much the same way as any of the CAPI classes you have already met.
(make-instance 'menu
:title "Foo"
:items '("One" "Two" "Three" "Four")
:callback 'test-callback)
(make-instance 'interface
:menu-bar-items (list *))
(display *)
This creates a CAPI interface with a menu,
Foo
, which contains four items. Choosing any of these items displays its arguments. Each item has the callback specified by the
:callback
keyword.
A submenu can be created simply by specifying a menu as one of the items of the top-level menu.
(make-instance 'menu
:title "Bar"
:items '("One" "Two" "Three" "Four")
:callback 'test-callback)
(make-instance 'menu
:title "Baz"
:items (list 1 2 * 4 5)
:callback 'test-callback)
(contain *)
This creates an interface which has a menu, called Baz , which itself contains five items. The third item is another menu, Bar , which contains four items. Once again, selecting any item returns its arguments.
Menus can be nested as deeply as required using this method.
CAPI User Guide (Windows version) - 30 Aug 2011