Ignore Ctrl+V keys in Memo

Posted in Clipboard

If you want to paste to your Memo component only some constant text, then you may use onKeyDown event. In this event you may clear a clipboard's content and set into SelText property your constant string.

uses Clipbrd;
...
procedure TForm1.Memo1KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if ((Key=Ord('V'))and(ssCtrl in Shift)) then
  begin
    Clipboard.Clear;
    Memo1.SelText:='Delphi is great';
    Key:=0;
  end;
end;