surely the key press event is the better and then you can evaluate the ascii character and filter it as acceptable or not, either setting e.handled to true or false as you wish