|
Allowing a Memo to overwright
//Insert is a private boolean variable of Form1
procedure TForm1.Memo1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if (Key = VK_INSERT) and (Shift = []) then
Insert := not Insert;
end;
procedure TForm1.Memo1KeyPress(Sender: TObject; var Key: Char);
begin
if not Insert
and (Memo1.SelStart < Memo1.GetTextLen)
and not (Key in [#27, #13, #9, #8])
and (Memo1.Text[Memo1.SelStart + 1] <> #13)
and (Memo1.SelLength = 0)
then Memo1.SelLength := 1;
end;
|