Protect Content of RichViewEdit

General TRichView support forum. Please post your questions here
Post Reply
charles.lambert
Posts: 26
Joined: Mon Jul 05, 2010 7:44 pm

Protect Content of RichViewEdit

Post by charles.lambert »

Hi,

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;
TextStyle number 6 has all those protection options : [rvprStyleProtect, rvprStyleSplitProtect, rvprModifyProtect, rvprDeleteProtect,
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
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

rvprStickToTop does not allow inserting before this text (if it starts the document).
rvprStickToBottom does not allow inserting after this text (if it ends the document).
Remove these options.
charles.lambert
Posts: 26
Joined: Mon Jul 05, 2010 7:44 pm

Post by charles.lambert »

Thanks a lot
Post Reply