Viewer vs Editor
TRichView has the following 3 groups of methods for modifying documents:
1.appending items to the end of the document (may be from file or stream);
2.modifying item with the given index;
3.loading files and streams.
All these methods have the following characteristics:
▪they do not require that the document is formatted (formatting is a preparing document for displaying)
▪even if the document was formatted before calling such method, it is not formatted after.
Table cells also have such methods.
TRichViewEdit has the following groups of methods for modifying documents:
1.all methods of TRichView;
All these methods (except for the methods of the group 1, inherited from TRichView) have the following characteristics:
▪document must be formatted before calling such methods;
▪these methods automatically reformat the affected area of documents;
▪they call OnChange event;
▪they can be safely called while a live spelling is running;
▪modifications can be undone and redone.
In an editor, the main application of the methods of the group 1 is generating new documents from scratch (after calling Clear).
The main application of other methods is performing user commands. They should not be used for generation of new document (because each such method updates documents, it can cause undesirable flicker, and they are much slower).
Important: You must not mix methods of group 1 and methods of groups 2-4! Methods inherited from TRichView do not update undo and redo buffers, and results of undo and redo commands will be unpredictable!
The only applications of methods of the group 1 is generating a new document, in the sequence:
1.Clear; (this method also clears undo and redo buffers);
2.One or several calls of methods of the group 1;
3.Format (after the document has been formatted, you can apply methods of the groups 2-4)
See also: Undo in tables