The framework also provides a set of classes that allow you to create an editable text document component that can embed other types of components. The embedded components must be based on the embedding classes provided by the Desktop frameworks. These classes derive from the standard editable text document component classes:
These classes work together in the same way the standard editable text document component classes work together. The framework also provides a stationery class, TEmbedderTextStationery, that you can use with RunDocument to quickly instantiate a text component that handles embedding--for example:
RunDocument -c -o TEmbedderTextStationery EditableTextLib
End users can embed components by either cutting and pasting or by draggng and dropping. These classes implement the following behaviors for embedding:
- If an end user embeds another text component into the root component, the text from the embedded component is absorbed into the root component.
- If an end user embeds another type of component into a text root component, the component is embedded as a special single character within the text model. The embedded component is displayed in a frame, which can be resized, dragged and dropped, and so on, but it flows with the text as if it were a character rather than as an anchored frame.
The end user can select an embedded component either by itself or as part of a text range that surrounds it. If the user types over a selection containing an embedded component, it is replaced by the input text.