# Editing Marked Text Fields

> Control typing at the edges of marked text fields with FieldEditAttr: a second input position, caret width, gray background and double-click handling.

- **Product:** TX Text Control ActiveX
- **Section:** Documentation
- **Kind:** Topic
- **Path:** TX Text Control ActiveX > Document Editor > Marked Text Fields > Editing Marked Text Fields
- **844 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-activex/document-editor/fields/editing/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-activex/document-editor/fields/editing/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-activex/document-editor/fields/editing/llms-full.txt

---

In an editable `TXTextControl`, users change the text of an editable marked text field like any other text. At the edges of a field, though, it is not always clear whether the input position is inside or outside the field. Per-field editing attributes, set with the [FieldEditAttr](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/fieldeditattr-property/llms-full.txt) property, help users type in the right place and see where a field begins and ends.

### Why the Edges of a Field Are Ambiguous

When the input position is directly in front of or behind a field, the next character can belong either to the field or to the text outside it. In normal editing mode, an inserted character takes the attributes of the character before it:

- Text typed directly behind a field belongs to the field.
- Text typed directly in front of a field belongs to the text in front of the field.

This is most noticeable when a marked text field is at the beginning or the end of the whole text. When a field ends the text, for example, CTRL+END moves the input position to the end of the text, which is also the end of the field, and everything typed there becomes part of the field.

### Add a Second Input Position

The extended editing mode of [FieldEditAttr](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/fieldeditattr-property/llms-full.txt) adds a second input position at the beginning and at the end of a field: one inside the field and one outside it. Users switch between the two with the LEFT ARROW and RIGHT ARROW keys. In the example above, the user presses CTRL+END to reach the end of the text and then RIGHT ARROW, so that the next character does not belong to the field.

In code, [FieldSetInputPos](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/fieldsetinputpos-method/llms-full.txt) decides whether such a doubled input position is inside or outside the field.

### Show Users Where a Field Is

Two further attributes help users find the right position:

- **Caret width.** The caret gets a different width while the input position is inside the field.
- **Background.** The complete text of the field is shown with a gray background while the input position is inside it.

### Combine the Attributes

The attributes are set for each field on its own and can be combined in any way, so one `TXTextControl` can hold several kinds of marked text fields that behave differently. [FieldEditAttr](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/fieldeditattr-property/llms-full.txt) takes the field's identifier and the sum of the values you choose; changing one option does not affect the others. A newly inserted field has the value `&H2 + &H8 + &H20 + &H80`.

| Value | Effect |
|---|---|
| `&H1` | A second input position at the beginning and the end of the field. |
| `&H2` | Normal editing at the beginning and the end of the field. |
| `&H4` | A different caret width while the input position is inside the field. |
| `&H8` | The normal text caret inside the field. |
| `&H10` | The field's text with a gray background while the input position is inside it. |
| `&H20` | The field's text with the standard control background while the input position is inside it. |
| `&H40` | Normal double-click processing inside the field, which starts a word-wise selection; [FieldDblClicked](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/fielddblclicked-event/llms-full.txt) is suppressed. |
| `&H80` | No normal double-click processing inside the field; [FieldDblClicked](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/fielddblclicked-event/llms-full.txt) is enabled. |

### Related Pages

- [Marked Text Fields](https://docs.textcontrol.com/tx-text-control-activex/document-editor/fields/llms-full.txt): inserting, finding and deleting fields and the events they raise.
- [Relating Data to a Marked Text Field](https://docs.textcontrol.com/tx-text-control-activex/document-editor/fields/data/llms-full.txt): storing a value such as a database field name with a field.
- [Using Marked Text Fields in Visual Basic](https://docs.textcontrol.com/tx-text-control-activex/document-editor/fields/tutorial/llms-full.txt): a Visual Basic application built around marked text fields.
- [FieldEditAttr](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/fieldeditattr-property/llms-full.txt): the property and its values in the reference.

---

## Nearby

- **Previous:** [Marked Text Fields](https://docs.textcontrol.com/tx-text-control-activex/document-editor/fields/llms-full.txt)
- **Next:** [Relating Data to a Marked Text Field](https://docs.textcontrol.com/tx-text-control-activex/document-editor/fields/data/llms-full.txt)
