RAD Studio |  |

Using Default Formatting for Numeric, Date, and Time Fields
See Also
Collapse All

Delphi provides built-in display and edit format routines and intelligent default formatting for TFloatField, TCurrencyField, TBCDField, TFMTBCDField, TIntegerField, TSmallIntField, TWordField, TDateField, TDateTimeField, TTimeField, and TSQLTimeStampField components. To use these routines, you need do nothing.

Default formatting is performed by the following routines:

Field component formatting routines

Routine | Used by . . .
FormatFloat | TFloatField, TCurrencyField
FormatDateTime | TDateField, TTimeField, TDateTimeField,
SQLTimeStampToString | TSQLTimeStampField
FormatCurr | TCurrencyField, TBCDField
BcdToStrF | TFMTBCDField

Only format properties appropriate to the data type of a field component are available for a given component.

Default formatting conventions for date, time, currency, and numeric values are based on the Regional Settings properties in the Control Panel. For example, using the default settings for the United States, a TFloatField column with the Currency property set to True sets the DisplayFormat property for the value 1234.56 to $1234.56, while the EditFormat is 1234.56.

At design time or runtime, you can edit the DisplayFormat and EditFormat properties of a field component to override the default display settings for that field. You can also write OnGetText and OnSetText event handlers to do custom formatting for field components at runtime.

See Also

Setting Display and Edit Properties at Design Time

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