views:

63

answers:

3

help i wnted the richedit cannot be highlighted/ disable the hightlight or selection of text? also remove the cursor pos. the application is intended for display only the rtf text and not editing so i dont need those features. in delphi

+3  A: 

you can set the SelLength property to 0 in the OnSelectionChange event

procedure TForm1.RichEdit1SelectionChange(Sender: TObject);
begin
 TRichEdit(Sender).SelLength:=0;
end;
RRUZ
+2  A: 

Just to clarify - you definitely need rich text features, like color, size, etc? And you definitely want to forbid copy from your control & paste somewhere else? Is that it exactly?

I would suggest that you override OnMouseUp, OnSaveCLipboard, OnSelectionChange from TRichEdit and the inherited methods GetSelTextBuf, CopyToClipboard, CutToClipboard, SelectAll .. maybe Repaint, Update and a few more.

Be sure of what you want - if you can live without rich text features, then just use some TLabels and write the text programatically.

If you must have rich text I see a few choices - write a lot of even handlers for your componet, or create your own component derived from TRichEdit, which makes it easier to have sevaral of them on one form, or look at sites like Tori's and see if someone else already made such acomponent.

Good luck.

LeonixSolutions
A: 

You could set the readonly property of the RichEdit to be true - this prevents keystrokes, etc.

No'am Newman