Giving the user control
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 |
Pop-up menu |
Provides access to the InsertFile and |
Display of nonprinting characters |
Carriage returns, tabs, and spaces. |
Display of fields |
Whether fields are visible at all, or |
Wordwrap |
Affects newly entered text only. If the user enters new text in an existing paragraph, word wrap |
Print margins |
Print margins can be set relative to |
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.
Users can change the available tools
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:
1 |
rte_1.PopMenu = TRUE |
Undoing changes
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:
1 |
IF rte_1.CanUndo() THEN<br>   rte_1.Undo()<br>ELSE<br>   MessageBox("Stop", "Nothing to undo.")<br>END IF |