Search code examples
macosmacos-carbon

Set menuitem's key-combo, like [Cmd+K, O]


For Carbon API. I found how to set one key for menuitem. I cannot find how to set key-combo there, e.g. make menuitem act on pressing Cmd+K then Cmd+L, ie [Cmd+K, Cmd+L].

How to do it in Carbon?


Solution

  • You can't.

    Key equivalents consisting of multiple keys are not a standard user interface idiom on any version of macOS, and the frameworks don't provide any support for them. If you want to implement this functionality anyway, you will need to process these key equivalents yourself, rather than relying on the Menu Manager to process them.

    (As an aside: Are you developing a new application, or working on an existing codebase? Carbon has been deprecated, in its entirety, since the release of macOS 10.8 in July 2012. The framework does not support 64-bit applications at all, and cannot access many newer operating system features. It is an incredibly poor choice for new development.)