In the Window or User Object painter, on the Document page of the RichTextEdit control’s property sheet, you can enable or disable the features in Table 16-1.
Features |
Details |
---|---|
Editing bars |
A toolbar for text formatting, a ruler bar, and a status bar. |
Pop-up menu |
Provides access to the InsertFile and clipboard commands, as well as the property sheet. |
Display of nonprinting characters |
Carriage returns, tabs, and spaces. |
Display of fields |
Whether fields are visible at all, or whether the field name or data displays. You can also change the background color for fields. |
Wordwrap |
Affects newly entered text only. If the user enters new text in an existing paragraph, word wrap is triggered when the text reaches the right edge of the control. To get existing text to wrap within the display, the user can tweak the size of the control (if it is resizable). |
Print margins |
Print margins can be set relative to the default page size. |
You can also specify a name for the document that is displayed in the print queue. The document name has nothing to do with a text file you might insert in the control.
When users display the property sheet for the rich text document, they can change the tools that are available to them, which you might not want. For example, they might:
Remove the display-only setting so that they can begin editing a document you set up as protected
Turn off the tool, ruler, or status bars
View input fields’ names instead of data
Disable the pop-up menu so that they cannot restore tools they turn off
You might want to guard against some of these possibilities. You can reset the property values for these settings in a script. For example, this statement restores the pop-up menu when triggered in an event script:
rte_1.PopMenu = TRUE
The user can press Ctrl+Z to undo a change. You can also program a button or menu item that calls the Undo function.
If Undo is called repeatedly, it continues to undo changes to a maximum of 50 changes. The script can check whether there are changes that can be undone (meaning the maximum depth has not been reached) by calling the CanUndo function:
IF rte_1.CanUndo() THEN rte_1.Undo() ELSE MessageBox("Stop", "Nothing to undo.") END IF