Hello,
I am making an NSMenuItem like this:
if let mainMenu = NSApplication.shared.mainMenu {
if let fileMenuItem = mainMenu.item(withTitle:"File") {
if let fileMenu = fileMenuItem.submenu {
let export = fileMenu.insertItem(withTitle:"Export", action:#selector(Filer.sharedInstance.Export), keyEquivalent:"e", at:5)
export.target = Filer.sharedInstance
export.isEnabled = true
export.keyEquivalentModifierMask = .command
}
}
}
I want it to show the Export command in the menu with "⌘E", but it dossn't. HOWEVER, if I change the "e" to "E" above, then it does show up -- but it wants me to use the shift key as well. That is, the menu looks like this: "Export ⇧⌘E".
Is there some reason it won't let me use a lower-case E? I know that the menus always show upper case letters. But I don't want to have to press shift. Just like, for example, the menu for Print shows "⌘P" but you can actually just hit "command-p" to print...
Is command-e used for somethng else and that's why it's stopping me?
EDIT: Looks like command-E is a Finder shortcut for Eject. Can I override that in my app so that I can use it for export in my menu?
Thanks