How to avoid the ding sound when Escape is pressed while a TEdit is focused?
问题 In code I have developed some years ago I have been using this a lot to close the current form on pressing the Escape key at any moment: procedure TSomeForm.FormKeyPress(Sender: TObject; var Key: Char); begin if key = #27 then close; end; This behaviour is defined for the TForm. The form's KeyPreview property is be set to True to let the form react to key presses before any other components. It all works perfectly well for the best part of the program, however, when the Escape key is pressed