1

Looking to add functionality to an NSButton, which when clicked, performs the same keystrokes as Command + "B". Have tried setting the NSButton.keyequivalent as well as NSButton.performKeyEquivalent, but with this case, I cannot find an event to handle an NSButton press.

// Mute Button Pressed
@IBAction func mutePressed(_ sender: NSButton) {
    //performKeyEquivalent(with: NSButton)
    muteButton.keyEquivalent = NX_MODIFIERKEY_COMMAND
}
jNiuk
  • 81
  • 9
  • Show the code you tried. – Magnas Jan 23 '20 at 17:23
  • Edited original post, set up an IBAction to handle the NSButton being pressed, but the key equivalents do not work. Cannot figure out why... – jNiuk Jan 23 '20 at 17:31
  • Does this answer your question? [Simulate keypress using Swift](https://stackoverflow.com/questions/27484330/simulate-keypress-using-swift) – Willeke Jan 23 '20 at 22:05
  • Unfortunately not, Im assuming that its an older version of swift, those methods don't even show up in swift for me. – jNiuk Jan 24 '20 at 02:02

0 Answers0