I want to protect the content of a RichViewEdit and then give the user the possibility to add some text to it without being able to delete/modify anything. What I'm currently doing is that I apply a textstyle and a parastyle to the text in the RichViewEdit. Both style contain every protection options. Then I add a new line with a text style that doesn't contain any protection and that allows the user to type in some text. The problem is, if the user deletes everything until the cursor get to the protected part and then he tries to type in something, he won't be able because the current text is now affected with the protection style.
Here's the code I have to protect the in RichViewEdit
Code: Select all
procedure TFormDesigner.ProtectRVEdit(ARVEdit: TRichViewEdit);
begin
ARVEdit.ApplyTextStyle(6);
ARVEdit.ApplyParaStyle(2);
ARVEdit.AddNL('', 0, 0);
ARVEdit.AddNL('', 0, 0);
ARVEdit.Format;
end;
rvprConcateProtect, rvprRVFInsertProtect, rvprDoNotAutoSwitch,rvprParaStartProtect,
rvprSticking, rvprSticking2, rvprSticking3, rvprStickToTop, rvprStickToBottom];
ParaStyle has all those protection options : [rvpaoReadOnly, rvpaoStyleProtect, rvpaoDoNotWantReturns];
Just to make sure everything is clear, I want to Protect the content of a RichViewEdit and then allow the user to add some text without being able to delete/modify anything that was previously protected.
Regards,
- Charles