1 year ago

#152004

test-img

user1580348

How to get rid of the built-in Paste shortcut in TRichEdit?

In a 32-bit VCL Application in Windows 10 in Delphi 11 Alexandria, I have a TRichEdit control. (Please note that the TRichEdit class in Delphi 11 Alexandria differs from previous Delphi versions).

Now, it seems that TRichEdit has a BUILT-IN Paste command and Shortcut: When I press CTRL+V, then the clipboard content gets inserted (image, formatted text).

So far, so good. But to allow the user to paste PLAIN TEXT (i.e., unformatted text) explicitly - even if there is formatted text on the clipboard, I have created a "Paste Plain Text" menu item command:

procedure TForm1.menuitemPastePlainTextClick(Sender: TObject);
begin
  var ClipboardPlainText := Vcl.Clipbrd.Clipboard.AsText;
  RichEdit1.SelText := ClipboardPlainText;
end;

I have assigned the shortcut SHIFT+CTRL+V to this command. (This shortcut is widely used among many applications for pasting unformatted text). However, when I type SHIFT+CTRL+V in RichEdit1, the FORMATTED text from the clipboard is pasted! Obviously, a BUILT-IN SHIFT+CTRL+V command in RichEdit1 has a higher priority than my custom shortcut.

So, how can I get rid of the built-in SHIFT+CTRL+V command in RichEdit1 to paste Plain Text?

delphi

keyboard-shortcuts

delphi-11-alexandria

trichedit

0 Answers

Your Answer

Accepted video resources