new TrvActionNew

Properties   Methods   Events

Top  Previous  Next

TrvActionNew is the action for "File | New" command.

Unit RichViewActions;


TrvActionNew = class(TrvActionCustomNew)



If you use this action, you must also use TrvActionSave and TrvActionSaveAs actions.

This action must be linked to TrvActionSave action, because TrvActionSave contains a list of all documents opened in TCustomRichViewEdit controls. This link may be defined explicitly (via ActionSave property) or implicitly (this action finds and uses TrvActionSave action placed on the same form/datamodule).

This action performs the following tasks, if style templates are not used:

1.If the document was modified, asks for saving and saves it (using TrvActionSave).

2.Clears the document (calls TCustomRichViewEdit.Clear); clears the background image; if rvfoSaveDocProperties is included in TCustomRichViewEdit.RVFOptions, clears its DocProperties and resets DocParameters properties.

3.Applies the default values specified in the properties of GetControlPanel: DefaultColor, DefaultMargin, DefaultDocParameters.

4.Calls OnNew event.

5.Calls OnMarginsChanged event of GetControlPanel component.

6.Formats the document (calls TCustomRichViewEdit.Format).

7.If GetControlPanel.AutoDeleteUnusedStyles=True, deletes unused styles (calls TCustomRichViewEdit.DeleteUnusedStyles(True, True, True)).

8.Stores the following values for this TCustomRichViewEdit using the properties of GetControlPanel: temporal file name = DefaultFileName, file format = DefaultFileFormat, custom filter index (used if file format is ffeCustom) = DefaultCustomFilterIndex. These values are stored in the list of documents maintained by TrvActionSave.

9.Calls OnDocumentFileChange event of TrvActionSave action.

If style templates are used:

The sequence of operations is the same, but the step #7 is different. The action resets text and paragraph styles according to StyleTemplates.

RichViewActions ©