Skip to main content

TcxCustomCurrencyEdit Class

Serves as the base class for classes that implement currency editors.

Declaration

TcxCustomCurrencyEdit = class(
    TcxCustomTextEdit
)

Remarks

A currency editor allows you to specify the format for the display value. Use the Properties object to adjust various settings specific to currency editors. They include display format, number of decimal places, range of valid values and many others. To access a value stored in a currency editor use the Value property. It always returns floating-point data while the EditValue property may specify NULL. EditValue is of type Variant. It contains NULL unless a valid value is assigned to EditValue or Value.

The Style property manages the look & feel of an editor. Working with styles is discussed in the TcxCustomEditStyle class topic.

All currency editors employ the same default display currency format. It is obtained from the CurrencyFormat property of the global format controller (a TcxFormatController object). The CurrencyFormat property is constructed based on system locale settings. To get a reference to the global format controller, call the cxFormatController function.

Currency editors implement the IcxFormatControllerListener interface, which provides notification of currency format changes from the global format controller. There are three ways to change the default display currency format:

  • Set the system locale settings. The format controller will notify editors of these changes by setting the TApplication.UpdateFormatSettings property to True. If you want to avoid updating default currency formats due to locale settings changes you have to set the TApplication.UpdateFormatSettings property to False.

  • Set the CurrencyString, CurrencyFormat, and CurrencyDecimals fields exposed by the global FormatSettings variable defined in the SysUtils unit. In RAD Studio 2010, these fields correspond to global variables defined in this unit. Editors will not receive notifications automatically. You need to manually call the GetFormats and NotifyListeners functions of the global format controller.

  • Set the CurrencyFormat property of the global format controller directly.

If you explicitly set the currency display format via the DisplayFormat member of the Properties object, the default currency format is not taken into account. To reset the currency format to the default value call the RestoreDefaults method of the Properties object.

Do not create instances of the TcxCustomCurrencyEdit class. Use its descendants such as TcxCurrencyEdit or TcxDBCurrencyEdit instead.

See Also