[Overview][Constants][Types][Classes][Procedures and functions][Index] | Reference for unit 'DBCtrls' (#lcl)

# TFieldDataLink

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

Maintains an association between a control, an action, and a field in a linked dataset.

## Declaration

Source position: dbctrls.pp line 43

`type TFieldDataLink = class(TDataLink)`
`protected`
`procedure ActiveChanged; override;` |  | ActiveChanged - method to process changes in the Active property.
`procedure EditingChanged; override;` |  | EditingChanged - method for processing changes in the Editing property.
`procedure LayoutChanged; override;` |  | LayoutChanged- called if layout is changed: tests validity of field then calls OnLayoutChange event handler.
`procedure RecordChanged(); override;` |  | RecordChanged - triggered if the contents of the current record change; calls Reset.
`procedure UpdateData; override;` |  | Signals the OnUpdateData event handler for pending changes to the linked dataset.
`procedure FocusControl(); override;` |  | FocusControl gives the input focus to the data-aware control in the class instance.
`public`
`constructor Create;` |  | Constructor for the class instance.
`function Edit;` |  | Edit - if the field can be modified, performs inherited Edit and shows editing status.
`procedure Modified;` |  | Updates the class when the linked dataset enters an edit state.
`procedure Reset;` |  | Checks whether the link is active, calls the OnDataChange event handler then sets IsModified to False.
`property Control: TComponent; [rw]` |  | The Control to which this datalink is attached.
`property Field: TField; [r]` |  | The Field to which the datalink is attached.
`property FieldName: string; [rw]` |  | FieldName - the name of the attached field, stored as a string.
`property CanModify: Boolean; [r]` |  | True if the linked field is capable of being modified.
`property Editing: Boolean; [r]` |  | True if the linked field is being edited.
`property EditingSource: Boolean; [r]` |  | Indicates if the data link is changing its source properties.
`property OnDataChange: TNotifyEvent; [rw]` |  | Event handler signalled when the field data link has been changed.
`property OnEditingChange: TNotifyEvent; [rw]` |  | OnEditingChange - event handler for a changed in the Editing property.
`property OnUpdateData: TNotifyEvent; [rw]` |  | OnUpdateData - event handler for updating any pending changes in the data.
`property OnActiveChange: TNotifyEvent; [rw]` |  | OnActiveChange - event handler for a change in the Active property.
`end;`

## Inheritance

`TFieldDataLink` |  | Maintains an association between a control, an action, and a field in a linked dataset.
`TDataLink`
?
`TObject`

## Description

TFieldDataLink is a TDataLink descendant which maintains an association between a control, an action, and a field in a linked dataset. TFieldDataLink extends the ancestor class to provide additional properties, methods, and events useful when working with a data-aware control linked to a field in a dataset.

The following key properties are added in the class:

- Control
- FieldName
- Field

The following events are added in the class:

- OnDataChange
- OnUpdateData
- OnEditingDone
- OnActiveChange

TFieldDataLink is used in the implementation of several data-aware controls. In most cases, it is used in an internal member and not exposed in the interface for the control. It can, however, be used as a public or published property.

## See also

TDBLookup |  | TDBLookup - used as source of data by TDBLookupListBox or TDBLookupComboBox, to find data from a lookup table.
TDBEdit |  | TDBEdit - a data-aware edit box for processing a single text-string from a dataset.
TDBText |  | Displays a string value stored in a dataset field.
TDBRadioGroup |  | TDBRadioGroup is a data-aware version of TRadioGroup, providing a series of mutually exclusive buttons to select an entry to insert into a database field.
TDBCheckBox |  | Implements a data-aware check box control.
TDBMemo |  | TDBMemo is a data-aware Memo box to process the multi-line text of a single field in a dataset.
TDBGroupBox |  | TDBGroupBox is a data-aware version of TGroupBox, allowing a number of data-aware objects to be grouped together on a form.
TDBImage |  | TDBImage - a data-aware Image box to display a single image from a dataset.
TDBCalendar |  | TDBCalendar - a data-aware version of TCalendar, for selecting a date to store in a database field.
TCustomDBComboBox |  | TCustomDBComboBox is a data-aware combo-box for displaying information from a database.
TDataLink