To allow users to Select All text in a memo or edit component by pressing
[Ctrl]A, set the form's KeyPreview property to True and add the following
handler to the form's OnKeyPress event:
procedure TMyForm.FormKeyPress(Sender: TObject;
var Key: Char); begin
if (ActiveControl is TCustomEdit) and (Key=#1)
then
begin (ActiveControl as TCustomEdit).SelectAll;
Key:=#0; end
end;
The Key:=#0 statement suppresses the annoying beep that occurs when
non-text characters are entered.