Working with Field Components - Overview
Go Up to Working with field components Index
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 DB.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 DBCtrls.TDBEdit and DBGrids.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 DB.TFloatField component has four properties that directly affect the appearance of its data:
TFloatField properties that affect data display :
Specifies whether data is displayed left-aligned, centered, or right-aligned.
Specifies the number of digits to display in a control at one time.
Specifies data formatting for display (such as how many decimal places to show).
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, Converting, and Accessing Field Values
- Setting a Default Value for a Field
- Working with Constraints
- Using Object Fields
- Understanding Datasets - Overview
- Designing Database Applications - Overview
- Using Data Controls
- Using Client Datasets - Overview
- Connecting to Databases - Overview
- Working with ADO Components
- Using dbExpress Datasets
- Using the Borland Database Engine
- Using Provider Components
- Creating Multi-tiered Applications - Overview
- Using XML in Database Applications