I think you have to create two things. First a subclass of CTextEdit where you need to override the onKeyDown method and inform the second thing you create namely a sub-controller which can create your custom CTextEdit class and control what should happen if a key down happens.
Cheers,
Arne