All Manuals > CAPI User Guide and Reference Manual > 8 Creating Menus

8.11 The Edit menu on Cocoa

This section is only applicable to LispWorks for Macintosh.

LispWorks for Macintosh adds a minimal Edit menu to all CAPI interfaces when running in the LispWorks IDE, which makes the edit gestures Command+V, Command+C and Command+X work in every interface displayed in the LispWorks IDE.

However, to implement these gestures in your CAPI/Cocoa runtime application, you must include an Edit menu explicitly in your interface definition, as described in 11.3.1 Adding menus.

Here is a minimal example of an Edit menu:

(edit-menu
 "Edit"
 (("Cut" :callback 'capi:active-pane-cut
   :enabled-function 'capi:active-pane-cut-p)
  ("Copy" :callback 'capi:active-pane-copy
   :enabled-function 'capi:active-pane-copy-p)
  ("Paste" :callback 'capi:active-pane-paste
   :enabled-function 'capi:active-pane-paste-p))
 :callback-type :interface)

To remove the automatic menu when running your program in the LispWorks IDE, pass the initarg :auto-menus nil when making the interface.

Note that, in the presence of an application interface (see cocoa-default-application-interface), a CAPI interface with no menus of its own and with :auto-menus nil uses the menu bar from the application interface.


CAPI User Guide and Reference Manual (Unix version) - 01 Dec 2021 19:32:36