Editing Text Fields

Text fields can be edited by the end-user like any other text in the document. To prevent changing the text of a text field, the TextField.Editable property can be used. If the text of a text field may be changed by the end-user but the text field itself must not be deleted, the TextField.Deleteable property can be set to false. In this case, the text of the field can be altered but a selection containing the field in the middle, cannot be deleted or replaced.

If a marked text field is fully editable, the two text input positions at the beginning and the end of a marked text field have a special meaning. If an end-user inserts text at one of these positions, it is not unique whether or not the newly inserted text belongs to the field. To solve this problem, the TextField class offers the DoubledInputPosition property. This implements a second input position, which the end-user can reach with the Left Arrow and Right Arrow keyboard keys.

Additionally, a visual feedback for the end-user can be set with the TextField.ShowActivated property. If this property is set to true, an actived text field is displayed with a gray background. A text field is defined as activated, if the current text input position is inside the field so that the next inserted character is added to the text of the field. If the mouse cursor is moved over a text field, it is changed to a hand cursor to indicate that there is a field. The hand cursor can be changed to another shape using the TextControl.FieldCursor property.

During editing, the application is informed through the following events of the TextControl class:

Event Description
TextControl.TextFieldChanged Event Occurs when the text of a text field has been changed. It does not occur, if formatting attributes of the field's text have been altered or if the text of the field has been changed from program code with the TextField.Text property.
TextControl.TextFieldClicked Event Occurs when a text field has been clicked with the mouse.
TextControl.TextFieldDoubleClicked Event Occurs when a text field has been double-clicked with the mouse. It does not occur, if the TextField.DoubleClickEvent property has been set to false.
TextControl.TextFieldEntered Event Occurs when the current input position has been moved from a position outside of a field to a position that belongs to a field. This only occurs, if an end-user has entered a field using the keyboard or a mouse-click. It does not occur, if the field has been entered through program code.
TextControl.TextFieldLeft Event Occurs when the current input position has left a text field. It occurs only, if a field has been left trough an end-user with the keyboard or a mouse-click. It does not occur if the field has been left through program code.

All event handlers for these events receive an argument of the type TextFieldEventArgs. This class has a TextField property through which the field that has caused the event can be obtained.

All derived classes of the TextField class mentioned above inherit the editing features so that these are also available for hypertext links and page number fields. Each of the described attributes can be defined for a single field in any combination, which means that different kinds of marked text fields can be implemented in a single Text Control.