Ahhh, looking at your code I now realize what the problem is.
Your "CodrTextView
" object is not subclassed from "NSTextView
" (and also, when you instantiate the object programatically or via your XIB or Storyboard, make sure the text view object is a custom class of "CodrTextView
" and not just another "NSTextView
"), so it's not actually getting the "acceptsFirstResponder
" or "canBecomeKeyView
" method calls either.
You need to descend "CodrTextView
" from "NSTextView
" instead of "NSView
", OR you need to create another subclassed "NSTextView
" object which will receive the "keyDown:
" event and then it'll call the code that calculates the string that goes into "lineNumberSpace
" of your main view.
Does this make sense to you now?