Page 1 of 1

Prevent characters from being entered or deleted

Posted: Wed May 23, 2018 9:03 am
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?

Re: Prevent characters from being entered or deleted

Posted: Wed May 23, 2018 10:18 am
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?

Re: Prevent characters from being entered or deleted

Posted: Wed May 23, 2018 10:50 am
by mohonko
It is necessary to change the selected part of the document. This requires that you can not cut the text, too.

Re: Prevent characters from being entered or deleted

Posted: Wed May 23, 2018 11:42 am
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.