2007. július 21., szombat

How to disable copying to clipboard from a TRichEdit


Problem/Question/Abstract:

I have been trying all day to keep a descendant of TRichEdit from copying/ cutting to the clipboard with the use of the [ctrl] +[c] and [ctrl] + [x] keyboard shortcuts with no luck at all.

Answer:

Try a different approach: to copy something there has to be a selection, otherwise there is nothing to copy. So attach a handler to the controls OnSelectionChange event. This handler contains the line:

with Sender as TRichEdit do
  SelLength := 0;

Nincsenek megjegyzések:

Megjegyzés küldése