I was trying to detect Ctrl+V from a TEdit
's OnKeyPress
event and I've noticed that the Key
parameter assumes an unusual value when pressing Ctrl+AnyKey.
Example:
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
ShowMessage(IntToStr(Ord(Key)));
end;
It produces the following results:
- Ctrl+Q 17
- Ctrl+W 23
- Ctrl+E 5
- Ctrl+R 18
- ...
- Ctrl+A 1
- Ctrl+Z 26
- Ctrl+C 3
- Ctrl+V 22
- Ctrl+X 24
I don't understand how keys are translated, what does these codes mean?
It seems it has nothing to do with the ASCII table:
Could anyone shed some light on this?