0

How can I implement modified behavior when the user clicks Ctrl+A (select all). I tried modifying the keyDown: event but it didn't seem to catch the event.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Mace
  • 201
  • 2
  • 5

1 Answers1

3

+A is generally mapped to selectAll: on the first responder. You should be able to simply implement the selectAll: method on any responder in the chain and it'll "just work".

Rob Keniger
  • 45,830
  • 6
  • 101
  • 134
bbum
  • 162,346
  • 23
  • 271
  • 359
  • 1
    And standard views such as NSTextView will already respond to `selectAll:` and friends, so for text selection, you don't need to do anything. – Peter Hosey Apr 19 '12 at 01:47
  • `keyDown:` is called and when I log the window's first responder in that, it's the same as this view but `selectAll:` isn't called. Wonder why. – trss Apr 09 '13 at 06:41
  • Got it, that's because I'm not calling `super`'s implementation in `keyDown:`. – trss Apr 09 '13 at 06:44
  • Responded too early. `selectAll:` doesn't get called even when `super`'s implementation of `keyDown:` is called with the same event. – trss Apr 09 '13 at 06:55
  • That was because I had set the table view to not accept selections. – trss Apr 09 '13 at 07:09