Mega Code Archive

 
Categories / Delphi / Examples
 

Close an application with the escape key

Title: close an application with the escape key? procedure TForm1.FormKeyPress(Sender: TObject; var Key: Char); begin if key = #27 { ESC } then Close; end; procedure TForm1.FormCreate(Sender: TObject); begin Form1.KeyPreview := True; end;