RAD Studio |  |

Working with Field Components: Overview
See Also
Collapse All

Field components represent individual fields (columns) in datasets. You can use field components to control the display and editing of data in your applications.

Field components are always associated with a dataset. You never use a TField object directly in your applications. Instead, each field component in your application is a TField descendant specific to the datatype of a column in a dataset. Field components provide data-aware controls such as TDBEdit and TDBGrid access to the data in a particular column of the associated dataset.

Generally speaking, a single field component represents the characteristics of a single column, or field, in a dataset, such as its data type and size. It also represents the field's display characteristics, such as alignment, display format, and edit format. For example, a TFloatField component has four properties that directly affect the appearance of its data:

TFloatField properties that affect data display

Property | Purpose
Alignment | Specifies whether data is displayed left-aligned, centered, or right-aligned.
DisplayWidth | Specifies the number of digits to display in a control at one time.
DisplayFormat | Specifies data formatting for display (such as how many decimal places to show).
EditFormat | Specifies how to display a value during editing.

As you scroll from record to record in a dataset, a field component lets you view and change the value for that field in the current record.

Field components have many properties in common with one another (such as DisplayWidth and Alignment ), and they have properties specific to their data types (such as Precision for TFloatField). Each of these properties affect how data appears to an application's users on a form. Some properties, such as Precision, can also affect what data values the user can enter in a control when modifying or entering data.

All field components for a dataset are either dynamic (automatically generated for you based on the underlying structure of database tables), or persistent (generated based on specific field names and properties you set in the Fields editor). Dynamic and persistent fields have different strengths and are appropriate for different types of applications.

The following topics discuss field components in greater detail:

- Dynamic Field Components
- Persistent Field Components
- Working with Field Component Methods at Runtime
- Displaying
- Setting a Default Value for a Field
- Working with Constraints
- Using Object Fields

See Also

Understanding Datasets

Designing Database Applications

Using Data Controls

Creating and Using a Client Dataset

Connecting to Databases

Working With ADO Components

Using Unidirectional Datasets

Using the Borland Database Engine

Using Provider Components

Creating Multi-tiered Applications: Overview

Using Decision Support Components

Using XML in Database Applications

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!