Skip to main content
A newer version of this page is available. .

TcxValueType Class

Specifies the type of item values.

Declaration

TcxValueType = class(
    TObject
)

Remarks

TcxValueType represents the base class specifying the type of item values. Items are assigned particular types for the following purposes:

  • performing compare operations for this type value;

  • checking the validity of some value;

  • determining the size of data this type presents and getting/setting a value at a specific memory offset;

  • writing and reading a value to and from a stream.

There are value type classes inherited from TcxValueType that correspond to most of TField types:

TField type TcxValueType descendant
ftBCD TcxCurrencyValueType
ftBoolean TcxBooleanValueType
ftCurrency and ftFloat TcxFloatValueType
ftDate, ftTime, and ftDateTime TcxDateTimeValueType
ftFMTBcd TcxFMTBcdValueType
ftInteger, ftAutoInc TcxIntegerValueType
ftLargeint TcxLargeIntValueType
ftSmallint TcxSmallintValueType
ftString TcxStringValueType
ftTimeStamp (corresponds to TSQLTimeStamp) TcxSQLTimeStampValueType
ftWideString TcxWideStringValueType
ftWord TcxWordValueType
Other field types TcxVariantValueType

In bound mode, items are assigned types automatically according to the table listed above. In unbound and provider mode, you need to specify the item type explicitly by setting the item’s DataBinding.ValueTypeClass property. You should set DataBinding.ValueTypeClass to the class which matches the type of values an item stores. For graphical fields, you may use TcxStringValueType.

In unbound mode, ValueTypeClass specifies the default editor assigned to an item.

ValueTypeClass Default editor
TcxBooleanValueType TcxCheckBox
TcxCurrencyValueType TcxCurrencyEdit
TcxDateTimeValueType TcxDateEdit
TcxFMTBcdValueType TcxCurrencyEdit
TcxSQLTimeStampValueType TcxDateEdit

For items with ValueTypeClass set to another value, a simple text editor (TcxTextEdit) is used.

Note

The TcxObjectValueType class can be used to store a non-visual object that represents arbitrary data for an unbound item. It is not recommended that you use visual objects for this purpose, since this can raise exceptions when destroying the form that contains these objects.

In bound mode, the field type specifies the default editor. See the FieldName property topic for details.

Inheritance

TObject
TcxValueType
See Also