[Overview][Constants][Types][Classes][Procedures and functions][Index] Reference for unit 'db' (#fcl)

TField

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

Provide access to the contents of a single field in a record

Declaration

Source position: db.pas line 261

type TField = class(TComponent)

protected

  function AccessError();

  procedure CheckInactive;

protected

  class procedure CheckTypeSize(); virtual;

protected

  procedure Change; virtual;

  procedure DataChanged;

  procedure FreeBuffers; virtual;

  function GetAsBCD; virtual;

  function GetAsBoolean; virtual;

  function GetAsCurrency; virtual;

  function GetAsLargeInt; virtual;

  function GetAsDateTime; virtual;

  function GetAsFloat; virtual;

  function GetAsLongint; virtual;

  function GetAsInteger; virtual;

  function GetAsVariant; virtual;

  function GetOldValue; virtual;

  function GetAsString; virtual;

  function GetAsWideString; virtual;

  function GetCanModify; virtual;

  function GetClassDesc; virtual;

  function GetDataSize; virtual;

  function GetDefaultWidth; virtual;

  function GetDisplayName;

  function GetCurValue; virtual;

  function GetNewValue; virtual;

  function GetIsNull; virtual;

  function GetParentComponent; override;

  procedure GetText(); virtual;

  function HasParent; override;

  procedure Notification(); override;

  procedure PropertyChanged();

  procedure ReadState(); override;

  procedure SetAsBCD(); virtual;

  procedure SetAsBoolean(); virtual;

  procedure SetAsCurrency(); virtual;

  procedure SetAsDateTime(); virtual;

  procedure SetAsFloat(); virtual;

  procedure SetAsLongint(); virtual;

  procedure SetAsInteger(); virtual;

  procedure SetAsLargeint(); virtual;

  procedure SetAsVariant(); virtual;

  procedure SetAsString(); virtual;

  procedure SetAsWideString(); virtual;

  procedure SetDataset(); virtual;

  procedure SetDataType();

  procedure SetNewValue();

  procedure SetSize(); virtual;

  procedure SetParentComponent(); override;

  procedure SetText(); virtual;

  procedure SetVarValue(); virtual;

public

  constructor Create(); override;

  

Create a new TField instance

  destructor Destroy; override;

  

Destroy the TField instance

  procedure Assign(); override;

  

Copy properties from one TField instance to another

  procedure AssignValue();

  

Assign value of a variant record to the field.

  procedure Clear; virtual;

  

Clear the field contents.

  procedure FocusControl;

  

Set focus to the first control connected to this field.

  function GetData();

  

Get the data from this field

public

  class function IsBlob; virtual;

  

Is the field a BLOB field (untyped data of indeterminate size).

public

  function IsValidChar(); virtual;

  

Check whether a character is valid input for the field

  procedure RefreshLookupList;

  

Refresh the lookup list

  procedure SetData();

  

Save the field data

  procedure SetFieldType(); virtual;

  

Set the field data type

  procedure Validate();

  

Validate the data buffer

  property AsBCD: TBCD; [rw]

  

Access the field's contents as a BCD (Binary coded Decimal)

  property AsBoolean: Boolean; [rw]

  

Access the field's contents as a Boolean value.

  property AsCurrency: Currency; [rw]

  

Access the field's contents as a Currency value.

  property AsDateTime: TDateTime; [rw]

  

Access the field's contents as a TDateTime value.

  property AsFloat: Double; [rw]

  

Access the field's contents as a floating-point (Double) value.

  property AsLongint: LongInt; [rw]

  

Access the field's contents as a 32-bit signed integer (longint) value.

  property AsLargeInt: LargeInt; [rw]

  

Access the field's contents as a 64-bit signed integer (longint) value.

  property AsInteger: Integer; [rw]

  

Access the field's contents as a 32-bit signed integer (longint) value.

  property AsString: String; [rw]

  

Access the field's contents as an AnsiString value.

  property AsWideString: WideString; [rw]

  

Access the field's contents as a WideString value.

  property AsVariant: variant; [rw]

  

Access the field's contents as a Variant value.

  property AttributeSet: String; [rw]

  

  property Calculated: Boolean; [rw]

  

Is the field a calculated field ?

  property CanModify: Boolean; [r]

  

Can the field's contents be modified.

  property CurValue: Variant; [r]

  

Current value of the field

  property DataSet: TDataSet; [rw]

  

Dataset this field belongs to

  property DataSize: Integer; [r]

  

Size of the field's data

  property DataType: TFieldType; [r]

  

The data type of the field.

  property DisplayName: String; [r]

  

User-readable fieldname

  property DisplayText: String; [r]

  

Formatted field value

  property FieldNo: LongInt; [r]

  

Number of the field in the record

  property IsIndexField: Boolean; [r]

  

Is the field an indexed field ?

  property IsNull: Boolean; [r]

  

Is the field empty

  property Lookup: Boolean; [rw]

  

Is the field a lookup field

  property NewValue: Variant; [rw]

  

The new value of the field

  property Offset: Word; [r]

  

Offset of the field's value in the dataset buffer

  property Size: Integer; [rw]

  

Logical size of the field

  property Text: String; [rw]

  

Text representation of the field

  property ValidChars: TFieldChars; [r]

  

Characters that are valid input for the field's content

  property Value: variant; [rw]

  

Value of the field as a variant value

  property OldValue: variant; [r]

  

Old value of the field

  property LookupList: TLookupList; [r]

  

List of lookup values

published

  property Alignment: TAlignment; [rw]

  

Alignment for this field

  property CustomConstraint: String; [rw]

  

Custom constraint for the field's value

  property ConstraintErrorMessage: String; [rw]

  

Message to display if the CustomConstraint constraint is violated.

  property DefaultExpression: String; [rw]

  

Default value for the field

  property DisplayLabel: String; [rws]

  

Name of the field for display purposes

  property DisplayWidth: LongInt; [rw]

  

Width of the field in characters

  property FieldKind: TFieldKind; [rw]

  

The kind of field.

  property FieldName: String; [rw]

  

Name of the field

  property HasConstraints: Boolean; [r]

  

Does the field have any constraints defined

  property Index: LongInt; [rw]

  

Index of the field in the list of fields

  property ImportedConstraint: String; [rw]

  

Constraint for the field value on the level of the underlying database

  property KeyFields: String; [rw]

  

Key fields to use when looking up a field value.

  property LookupCache: Boolean; [rw]

  

Should lookup values be cached

  property LookupDataSet: TDataSet; [rw]

  

Dataset with lookup values

  property LookupKeyFields: String; [rw]

  

Names of fields on which to perform a locate

  property LookupResultField: String; [rw]

  

Name of field to use as lookup value

  property Origin: String; [rw]

  

Original fieldname of the field.

  property ProviderFlags: TProviderFlags; [rw]

  

Flags for provider or update support

  property ReadOnly: Boolean; [rw]

  

Is the field read-only

  property Required: Boolean; [rw]

  

Does the field require a value

  property Visible: Boolean; [rw]

  

Should the field be shown in grids

  property OnChange: TFieldNotifyEvent; [rw]

  

Event triggerd when the field's value has changed

  property OnGetText: TFieldGetTextEvent; [rw]

  

Event to format the field's content

  property OnSetText: TFieldSetTextEvent; [rw]

  

Event to set the field's content based on a user-formatted string

  property OnValidate: TFieldNotifyEvent; [rw]

  

Event to validate the value of a field before it is written to the data buffer

end;

Inheritance

TField

  

Provide access to the contents of a single field in a record

|

TComponent,IUnknown,IInterfaceComponentReference

|

TPersistent

|

TObject

Description

TField is an abstract class that defines access methods for a field in a record, controlled by a TDataset instance. It provides methods and properties to access the contents of the field in the current record. Reading one of the AsXXX properties of TField will access the field contents and return the contents as the desired type. Writing one of the AsXXX properties will write a value to the buffer represented by the TField instance.

TField is an abstract class, meaning that it should never be created directly. TDataset instances always create one of the descendent classes of TField, depending on the type of the underlying data.

See also

TDataset

  

Base class for records-based data-access

TFieldDef

  

Class to describe one field in a record in a dataset

TFields

  

Collection of #fcl.db.TField instances

The latest version of this document can be found at lazarus-ccr.sourceforge.net.