SubTextParts have been introduced in version X13 (23.0) as a new document element to realize the new MailMerge merge block concept. But this element can be used for other tasks as well.

A SubTextPart object represents a user-defined part of a TX Text Control document with a specific Name and ID. The following code can be used to convert the currently selected text into a SubTextPart:


The Name property is set to protected which is simply an identifier in this sample that defines that this SubTextPart should be protected from user changes.

When the caret enters the SubTextPart, the SubTextPartEntered event is used to set the EditMode property of TX Text Control to ReadAndSelect.

On leaving the SubTextPart, the SubTextPartLeft event is used to switch back to edit mode.


This is just one more application for this new element. This element can be used to store additional information, comments or to highlight text parts permanently in different colors.