Question:
I would like to have shortcut to close my application using ESC key.

Answer:
Here the simple program, unfortunatelly you need to activate the program first before close it using ESC Key.


procedure TForm1.FormKeyPress(Sender: TObject; var Key: Char);
begin
if key = #27 then Close;
end;


procedure TForm1.FormCreate(Sender: TObject);
begin
Form1.KeyPreview := True;
end;

5 Responses so far.

Post a Comment

Thank you for your comment.

Any request and idea are welcome.

CLICK TO REGISTER