Search code examples
delphiwindows-xpdelphi-7memo

Is there any way to disable selecting of text in a memo control?


Is there any way to disable selecting of text in a memo control because it's very anoying.
The memo is Read Only.


Solution

  • I think you should rethink. I realise that your control is used in read-only mode, but still, what if the end user wishes to copy a part of the text? Then he needs to be able to select the part in question.

    Still, if you are certain that you need to disable every kind of selection, the easiest approach is to use a TRichEdit instead of the TMemo, and do simply

    procedure TForm1.RichEdit1SelectionChange(Sender: TObject);
    begin
      RichEdit1.SelLength := 0;
    end;