Object fields are fields that represent a composite of other, simpler datatypes. These include ADT (Abstract Data Type) fields, Array fields, DataSet fields, and Reference fields. All of these field types either contain or reference child fields or other data sets.
ADT fields and array fields are fields that contain child fields. The child fields of an ADT field can be any scalar or object type (that is, any other field type). These child fields may differ in type from each other. An array field contains an array of child fields, all of the same type.
Dataset and reference fields are fields that access other data sets. A dataset field provides access to a nested (detail) dataset and a reference field stores a pointer (reference) to another persistent object (ADT).
Types of object field components
Component Name |
Purpose |
TADTField |
Represents an ADT (Abstract Data Type) field. |
TArrayField |
Represents an array field. |
TDataSetField |
Represents a field that contains a nested data set reference. |
TReferenceField |
Represents a REF field, a pointer to an ADT. |
When you add fields with the Fields editor to a dataset that contains object fields, persistent object fields of the correct type are automatically created for you. Adding persistent object fields to a dataset automatically sets the dataset's ObjectView property to True, which instructs the dataset to store these fields hierarchically, rather than flattening them out as if the constituent child fields were separate, independent fields.
The following properties are common to all object fields and provide the functionality to handle child fields and datasets.
Common object field descendant properties
Property |
Purpose |
Fields |
Contains the child fields belonging to the object field. |
ObjectType |
Classifies the object field. |
FieldCount |
Number of child fields belonging to the object field. |
FieldValues |
Provides access to the values of the child fields. |
Both ADT and array fields contain child fields that can be displayed through data-aware controls.
Data-aware controls such as TDBEdit that represent a single field value display child field values in an uneditable comma delimited string. In addition, if you set the control's DataField property to the child field instead of the object field itself, the child field can be viewed an edited just like any other normal data field.
A TDBGrid control displays ADT and array field data differently, depending on the value of the dataset's ObjectView property. When ObjectView is False, each child field appears in a single column. When ObjectView is True, an ADT or array field can be expanded and collapsed by clicking on the arrow in the title bar of the column. When the field is expanded, each child field appears in its own column and title bar, all below the title bar of the ADT or array itself. When the ADT or array is collapsed, only one column appears with an uneditable comma-delimited string containing the child fields.
The following topics discuss each type of object field in more detail:
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
|
What do you think about this topic? Send feedback!
|