In Delphi 7's TMemo control, an attempt to do the key combo Ctrl + A
to select all does not do anything (doesn't select all). So I've made this procedure:
procedure TForm1.Memo1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
var
C: String;
begin
if ssCtrl in Shift then begin
C:= LowerCase(Char(Key));
if C = 'a' then begin
Memo1.SelectAll;
end;
end;
end;
Is there a trick so that I don't have to do this procedure? And if not, then does this procedure look OK?
This is more elegant:
procedure TForm1.Memo1KeyPress(Sender: TObject; var Key: Char);
begin
if Key = ^A then
begin
(Sender as TMemo).SelectAll;
Key := #0;
end;
end;