Reputation: 681
I'm messing around with the Cocoa text system, and right now, all I need to be able to do is detect when the user presses either the Tab or Return key.
Not sure if this makes a difference, but I built a text editor from scratch programmatically, so I only have a reference to the NSTextStorage object, as everything else has been released.
Any help would be much appreciated. And I apologize for the noobile question.
Upvotes: 1
Views: 5499
Reputation: 16240
- (void)keyDown: (NSEvent *) event {
if ([event keyCode] == 13){ //For return key
}
if ([event keyCode] == 9){ //For tab key
}
}
This method is to be overridden and will be called when ever a key is pressed.
Upvotes: 2