Check for direction key press in TextEditorComponent()?


I’m trying to find a way to intercept presses to the direction keys in the TextEditorComponent but since not text has changed they don’t get picked up in the usual channels. I wonder could a handleDirectionKey() be added to the other TextEditorComponent handle methods?


Don’t want to bloat it too much with callbacks like that… Can’t you override keyPressed?


I’ll take a look…


CodeEditorComponent::keyPressed isn’t virtual?


CodeEditorComponent inherits Component in which keyPressed is virtual. You can’t un-virtualise a method even if the virtual keyword isn’t explicitly specified.

Now of course that has recently changed in C++11 with the ‘final’ keyword in which you can stop a function from being overridden but that isn’t applicable here. If you’re not getting the callback make sure your constness matches the base implementation.


Thanks Dave. Another lesson learned!