Override user typed key

Asked

Viewed 610 times

1

Num Edit Delphi normal want to undo the key the user typed.
If it was at the event KeyPress, quiet, just attribute #0 for the variable key.
But I am and accurate use the event KeyDown. In this event I am not succeeding. I have already tried to assign 0, abort then... but without success.
Anyway, is it possible? If so, how to do?

1 answer

2


The correct thing is to control KeyPress.

In the KeyDownor in the KeyUp is for additional validations, but you can try:

  if Key = VK_DELETE then
  begin
    Abort;
  end;

This way we abort the effect of the delete key.

see more in dokwiki

  • It makes sense not to be possible by KeyDown, I tried every way I know and I couldn’t. Your suggestion may work in some cases, but not at all... if it is to override the typing of an alphanumeric key for example, it does not work. I’ll take it because the first part is right. Thank you.

  • Remember to activate the KeyPreview form?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.