Custom Input Masks (Numeric/Integer)

 

Numeric input masks are specifically designed for entering numeric values (integer, float values, currencies, percents, etc.).  Specific numeric masks are dependent upon the current culture (regional) settings.

Input masks allow end-users to edit numeric values of common numeric types.  A standard mask represents a string of the Axx form where A is a single alphabetic character (mask specifier), and xx is an optional integer called the precision specifier.  The available mask specifiers are listed in the following tables.  The precision specifier ranges from 0 to 99 and controls the number of significant digits or zeros to the right of the decimal point.

Input Mask Character

Name

Description

Samples

Culture: English (USA)

C or c

Currency

The mask for entering a currency amount. The input mask contains a value part which can be edited by an end-user, and a currency symbol which cannot be edited.  The mask's format is determined by the current culture.

The precision specifier indicates the desired number of decimal places. If the precision specifier is omitted, the precision will be set to 2.

Description: http://documentation.devexpress.com/HelpResource.ashx?help=WindowsForms&document=img4147.jpg(EditMask = "c"; EditValue = 1024.5)

Description: http://documentation.devexpress.com/HelpResource.ashx?help=WindowsForms&document=img4148.jpg(EditMask = "c0"; EditValue = 20010)

D or d

Decimal

The mask for entering integer values of a fixed and flexible length.

The precision specifier indicates the maximum number of digits that can be entered.  If the precision specifier is equal to 0 or omitted, the length of the input string is not limited.

If the editor's value is real, the fractional part of the value will be discarded during editing.

Description: http://documentation.devexpress.com/HelpResource.ashx?help=WindowsForms&document=img4149.jpg(EditMask = "d"; EditValue = 1501)

F or f

G or g

Fixed-point

The mask for entering real numbers with a fixed-length fractional part.

The precision specifier indicates the desired number of decimal places.  If the precision specifier is omitted, the precision will be set to 2.

Description: http://documentation.devexpress.com/HelpResource.ashx?help=WindowsForms&document=img4150.jpg(EditMask = "f"; EditValue = 1024.5)

N or n

Number

The mask for entering the integers of real values. Thousand separators are inserted between each group of three digits to the left of the decimal point.

The precision specifier indicates the desired number of decimal places.  If the precision specifier is omitted, the precision will be set to 2.

Description: http://documentation.devexpress.com/HelpResource.ashx?help=WindowsForms&document=img4151.jpg(EditMask = "n"; EditValue = 1024.5)

P

Percent (mode 1)

The mask for entering percents. The entered string is converted into a number "as is" (compare with the 'p' mask).  So, if the "15 %" string is entered, the editor's value will be 15.

The precision specifier indicates the desired number of decimal places.  If the precision specifier is omitted, the precision will be set to 2.

Description: http://documentation.devexpress.com/HelpResource.ashx?help=WindowsForms&document=img4152.jpg(EditMask = "P"; EditValue = 25)

p

Percent (mode 2)

The mask for entering percents. The entered string is converted to a number and then divided by 100. The result is used as the editor's value (compare with the 'P' mask).  So, if the "15 %" string is entered the editor's value will be 0.15.

The precision specifier indicates the desired number of decimal places.  If the precision specifier is omitted, the precision will be set to 2.

Description: http://documentation.devexpress.com/HelpResource.ashx?help=WindowsForms&document=img4152.jpg(EditMask = "p"; EditValue = 0.25)

 

You can also use the following characters to create custom masks for editing numeric values.

Character

Name

Description

0

Zero placeholder

A decimal digit (0-9) can be entered in the corresponding position. Empty placeholders are represented by '0' characters.  When the input string is converted to the editor's value, digits left empty are interpreted as zeros.

#

Digit placeholder

A decimal digit (0-9) can be entered in the corresponding position or left empty.  Empty placeholders are not displayed.  When the input string is converted to the editor's value, digits left empty are not stored in the result.

.

Decimal point

The first '.' character in the format string determines the location of the decimal separator in the formatted value.  The actual character used as the decimal separator is determined by the current culture (regional) settings.

,

Thousand separator

If the ',' character appears in the mask, thousand separators will be inserted between each group of digits to the left of the decimal point as defined by the culture (regional) settings.

%

Percentage placeholder

If the '%' character appears in the mask, the value entered is divided by 100 when converted to the editor's value.  So, if the '15 %' string is entered, the stored value will be '0.15'.

The percent character used is dependent upon the current culture.  An appropriate symbol is inserted in the edit box at the location where the '%' symbol appears in the mask.

%%

Percentage placeholder

If the '%%' string appears in the mask, the entered value is not divided by 100 when it's converted to the editor's value. So, if the '15 %' string is entered, the edit value will be '15'.

The percent character used is dependent upon the current culture.  An appropriate symbol is inserted in the edit box at the location where the '%' symbol appears in the mask.

\

Escape character

The character following the escape character is inserted into the edit box literally.  To display a backslash in the edit box the mask should contain the '\\' string.

;

Section separator

The ';' character is used to separate the masks for positive and negative values.

The mask can contain two parts delimited by the ';' character.  The first part defines the mask for entering positive values; the second part specifies a mask for entering negative values. An end-user can toggle the value's sign by pressing the '-' key. In this case, depending upon the value's sign, the value entered is automatically re-formatted using the appropriate mask.

If the ";" character is followed by an empty string, the editor will not allow end-users to enter negative values.

$

Currency character

Defines the position of the currency symbol determined by the current culture.

Any other character

Literal character

Any other characters that appear in the mask are inserted into the edit box literally.

To display special characters in the edit box literally, they should be preceded with the escape character ('\').

 

Note:  If an editor's edit value is of the integer type, the editor only accepts integer values.  An end-user will not be able to enter a fractional part of a number, even if it's allowed by the editor's mask

End-User Capabilities

 

Numeric masks allow end-users to enter numeric values only. Text cannot be edited in this mask mode.

·         Pressing the '-' key changes the sign of the value being edited. The caret can be placed at any position within the edit box.

 

·         Pressing the Up-Arrow and Down-Arrow keys increments or decrements the digit to the left of the caret's position. If the entire text is selected, pressing these keys increments or decrements the digit to the left of the decimal point.

 

·         Scrolling the mouse wheel increments or decrements the digit to the left of the caret's position. If the entire text is selected, scrolling the mouse wheel increments or decrements the digit to the left of the decimal point.

Examples

 

The following are examples of custom numeric masks. See the table in the Predefined Masks sub-section for examples of predefined masks.

1.       A mask for entering a real number which has a maximum of 4 digits to the left of the decimal point: #,##0.00

Groups of three digits will be separated using thousand separators. The fractional part of the value will always contain two digits.

Description: http://documentation.devexpress.com/HelpResource.ashx?help=WindowsForms&document=img4153.jpg (Stored Value = 3080.6)

Description: http://documentation.devexpress.com/HelpResource.ashx?help=WindowsForms&document=img4154.jpg (Stored Value = -3080.6)

2.     The same mask for positive values. Negative values will be enclosed with double angle brackets: #,##0.00;<<#,##0.00>>

Description: http://documentation.devexpress.com/HelpResource.ashx?help=WindowsForms&document=img4155.jpg (Stored Value = -3080.6)

Note:  When a numeric\integer input mask is enabled, any new attributes that are indexed will NOT store the mask characters along with the data.  Historical data that has already been indexed before the mask was created will have the mask applied when displaying the fields but the underlying data will NOT remain unchanged.

 

List Attribute

The “List” attribute data type screen is a bit different from the other data types.  In the screenshot below, the “List” data type has been selected for the new attribute name, “Status”. 

image                                                                     

Once this data type is selected, the “Options” section changes as illustrated below.  List-based attributes allow you to select an item from a list of choices you define such as the example displayed.  To modify items in the list, click the “Modify List” button.

Note:  The test area does NOT apply to the “List” and “True/False” data types.

image

In the Modify List window, add an item by entering its name near the top. Items may also be edited or removed from the grid below. By default each list item is enabled.  Deselecting this checkbox will remove that item from the list shown during indexing but will leave it available for searching previously indexed documents.

 

 

image