Prevent characters from being entered or deleted

General TRichView support forum. Please post your questions here
Post Reply
mohonko
Posts: 13
Joined: Fri Mar 23, 2018 9:17 am

Prevent characters from being entered or deleted

Post by mohonko »

Hello! There is a RichViewEdit In which I need to prevent any new content from being entered and deleted, but need to keep the ability to change the font, style, alignment, colors, list styles. Is it possible to do it in RichViewEdit in the least labour-intensive way?
Sergey Tkachenko
Site Admin
Posts: 17555
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Prevent characters from being entered or deleted

Post by Sergey Tkachenko »

Do you want to apply changes to part of documents (to selected text)?
Or do you want to change styles in the whole document?
mohonko
Posts: 13
Joined: Fri Mar 23, 2018 9:17 am

Re: Prevent characters from being entered or deleted

Post by mohonko »

It is necessary to change the selected part of the document. This requires that you can not cut the text, too.
Sergey Tkachenko
Site Admin
Posts: 17555
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Prevent characters from being entered or deleted

Post by Sergey Tkachenko »

The simplest solution is disabling editing in TRichViewEdit by assigning RichViewEdit.ReadOnly = True.
Before any allowed operation, assign RichViewEdit.ReadOnly = False, perform this operation, then assign RichViewEdit.ReadOnly = True again.


An alternative solution, with using protection options, seems to be more complicated.
Post Reply