Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved


Chapter 3 Tasks : Using Numeric Controls

Using 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.
What is a Numeric Control?
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
The above 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 Table 16. Each character is replaced with locale-specific text when the number is formatted.
 
 
Some sample formats are listed in Table 17:
Inserting a Numeric Control
To insert a numeric control, perform the following steps:
1.
2.
Go to the Properties tab in the Properties view for the text input control and select the Numeric check box. This enables the Format options.
3.
a.
External Reference: Select a format from an external resource. See Inserting External Reference Format
b.
Custom: Define a custom format. See Inserting a Custom Format
Figure 120 Numeric Control Property of Text Input Control
Inserting External Reference Format
By selecting the External Reference option, you can use one of the predefined formats from the common resource bundle. To use an external reference format, perform the following steps:
1.
Select External Reference under the Format options.
2.
3.
You can also create your own custom formats and add them to the Resource Picker list.
The new custom formats must be placed under the Presentation Resources special folder.
To create your own custom format, perform the following steps:
1.
In the Project Explorer, go to the context menu of the Presentation Resources folder and click New > File.
2.
On the New File dialog box, type the file name and use the extension .properties. The builder creates matching <name>.properties.json and <name>.locales.json files in the same folder.
3.
A sample custom format is as follows:
format_myformat1 = 000.000
format_myformat2 = \u00A4#,#0.0;[\u00A4#,##0.0]
 
’\u00A4’ is the Unicode value for the ¤ currency symbol.
The newly-created properties file must be added to the resources list of the form. To add the properties file in the resource list, perform the following steps:
1.
Go to the Resources tab in the Properties view at the root level of the form.
2.
3.
Click the icon to display the Pick Resource dialog box.
4.
Select the newly-created .properties file from the list, and click OK.
Figure 121 Add Custom Format File to Resource List
Once you have added the newly-created .properties file as a form external resource reference, the new formats are available in the Resource Picker.
Inserting a Custom Format
By using the Custom option, you can choose from some example formats or define your own format inline. To use a custom format, perform the following steps:
1.
Select Custom under the Format options.
2.
Figure 122 Use Custom Format for Numeric Control
3.
Editing a Numeric Control
To edit a numeric control, the text input control must have focus. For editing, the number is displayed in the raw format and in full precision. The prefix, suffix, and the group separators are not displayed. The decimal point is displayed using the conventions of the active locale. You can edit the values and move out of the control.
When the text input control loses focus, the value in the text input control is displayed using the specified display format.
 

Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved