Numeric Controls
A numeric control is not a distinct control type, but is a special property that can be enabled for a text input control. It is used to display data in a specified format so that it is easier to read.
The numeric control property of a text control enables you to specify the display format of numeric and currency values. It only changes the way the control value is displayed and does not affect the way the value is edited or saved.
To define a format, you can use the following pattern:
PosPrefix PosFormat PosSuffix;NegPrefix NegFormat NegSuffix
This pattern defines a format for positive numbers (PosPrefix PosFormat PosSuffix) and a format for negative numbers (NegPrefix NegFormat NegSuffix) separated by a semicolon (;).
The format can include the formatting characters shown in the table Numeric Control Formatting Characters. Each character is replaced with locale-specific text when the number is formatted.
Character | Description |
---|---|
0 (Digit) | Used to signify the minimum number of digits to be displayed. Each instance of the character represents a position for one digit. If no value exists in a position, a zero (0) is displayed. This character is not valid within prefix or suffix. Left of the decimal point: leading 0's are shown. Right of the decimal point: trailing 0's are shown. |
# (Optional Digit) | Used to signify the minimum number of digits to be displayed. Each instance of the character represents a position for one digit. If no value exists in a position, a blank space is displayed. This character is not valid within prefix or suffix. Left of the decimal point: leading 0's are not shown. Right of the decimal point: trailing 0's are not shown |
. (Decimal separator) | Used as a numeric or monetary decimal separator. This character is not valid within prefix or suffix and is localized based on the locale settings. |
- (Minus sign) | Used to indicate a negative number. This character is only valid in the prefix or suffix. |
, (Grouping separator) | Used to group the number format. The grouping separator must not be used to the right of the decimal point in a number format. This character is localized and is not valid within prefix or suffix. |
; | Separates positive and negative sub-patterns. This character is not valid within number format, prefix or suffix. |
¤ | Currency sign (Unicode code point-\u00A4). This character is valid only within prefix or suffix and is replaced by the localized currency symbol. |
Some sample formats are listed in the table Numeric Control Sample Formats: