Skip to content

CreateCurrencyMask - cCJGridColumn

Provides a quick mechanism for creating a currency column with a mask based on the number of digits passed

Type: Procedure

Parameters

Parameter Type Description
iLeft Integer Number of digits to the left of the decimal separator
iRight Integer Number of digits to the right of the decimal separator

Syntax

Procedure CreateCurrencyMask Integer iLeft Integer iRight

Call Example

Send CreateCurrencyMask iLeft iRight

Description

CreateCurrencyMask provides a quick way to create a currency column. You pass it the allowed digits to the right and left of the decimal separator and it sets the data type and a mask based on the default system mask.

It sets the peDataType property to Mask_Currency_Window.

It sets the psMask value by creating a mask based on the digits passed and the default mask format defined by the global Default_Currency_Mask string. This creates a currency mask which uses the appropriate regional settings with the appropriate number of digits.

Data-aware grid columns (cDbCJGridColumn) are usually assigned their data type and mask based on their data dictionaries and their data binding (piBindingTable, piBindingColumn). Non-data-aware grid columns and any columns that are not bound to a data dictionary (e.g. calculated columns) must have their data type and mask manually assigned. CreateCurrencyMask provides an easy way to define currency columns.

Object oDiscount is a cDbCJGridColumn
    Send CreateCurrencyMask 6 2
    Set pbFocusable to False
    Set piWidth to 75
    Set psCaption to "Discount"

    Procedure OnSetCalculatedValue String ByRef sValue
        Move (Invt.Unit_Price * .85) to sValue
    End_Procedure
End_Object

Numeric masks may be created using CreateNumericMask

If you need to create custom masks, you may do so by directly setting peDataType and psMask. The global functions Number_Default_Mask and Field_Number_Default_Mask may be used to create customized numeric and currency masks.

Note that this is a procedure and that it sets the peDataType, psMask and piMaxLength properties. Since this will change existing property values and these property values can be changed after the message, the placement of this matters.