<< Click to display table of contents >> TrvActionOpen |
TrvActionOpen is the action for "File | Open..." command.
Unit RichViewActions;
Syntax
TrvActionOpen = class(TrvActionCustomNew)
TObject TPersistent TComponent TBasicAction TContainedAction TCustomAction TAction |
Description
The action displays a file opening dialog and loads the chosen file in TCustomRichViewEdit component. After opening, this editor is associated with the chosen file name and format, so subsequent executions of TrvActionSave action save content of this TCustomRichViewEdit component in this file in this format.
The following formats are supported:
•RichView Format (RVF)
•Microsoft Word Document (DocX)
•Rich Text Format (RTF)
•Text files (TXT, Unicode and ANSI)
•Markdown (MARKDOWN, MDOWN, MKDN, MD, MKD, MDWN, MDTXT, MDTEXT)
•HTML
•RichViewXML Format (XML, only if RichViewXML is used)
•custom formats, supported in GetControlPanel.OnCustomFileOperation event.
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 may be linked to TrvActionNew action. This link may be defined explicitly (via ActionNew property) or implicitly (this action finds and uses TrvActionNew action placed on the same form/datamodule). If linked, TrvActionNew is used to reset editor before loading (it is especially important, if style templates are used).
This action performs the following tasks:
1.If the document was modified, asks for saving and saves it (using TrvActionSave).
2.Shows a file opening dialog allowing the user to choose the file for opening.
3.If the user chose a file, calls LoadFile method. The file format is determined not by the file extension but by the filter index chosen in the file opening dialog.