Relating Data to a Marked Text Field
A marked text field can carry data of its own that users never see: a database field name or any other string or number your application needs. TXTextControl stores it for each field through the FieldData property, which takes the field's identifier.
Link Fields to Database Fields
A typical use is a TXTextControl that shows the contents of a database. You create one marked text field for each database field and store the name of the database field in the marked text field with FieldData.
Other parts of the program then read FieldData to find out which database field a marked text field is linked to. When the user clicks a marked text field, for example, the FieldClicked event passes the field's identifier. Read FieldData with this identifier, and it returns the name of the database field the user clicked.
What the Data Can Be
- Strings and numbers. FieldData accepts both.
- One value per field. Setting new data overwrites all data set before, whatever its kind.
- Separate from the text. Setting or reading the data does not change the text the field shows.
- Kept with the field. When a field is copied through the clipboard or saved to a file, its data is copied or saved with it.