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 } 
4
  • Show the code you tried. Commented Jan 23, 2020 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... Commented Jan 23, 2020 at 17:31
  • Does this answer your question? Simulate keypress using Swift Commented Jan 23, 2020 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. Commented Jan 24, 2020 at 2:02

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.