|
»Input Pro
» Product Tour
» fpDoubleSingle Control
|
|
jump to:
|
|
fpDoubleSingle Control |
|
 The fpDoubleSingle control is a formatted edit
control that supports floating-point numbers and supports many numeric formats.
You can limit the range of values allowed in the control by specifying minimum
and maximum values, customize how the user interacts with the control, and add
buttons to the control to customize user interaction.
Displaying a Separator Character |
Working with Negative Numbers |
Customizing User Entry | Setting and
Returning Floating-Point Values | Formatting
Decimal Values | Providing Buttons
| Validating Floating-Point Data
Back to Top
You can group digits using a separator character
to assist readability. For example, it is common in the United States to
represent large figures with commas separating every three digits to show
multiples of one thousand, as shown in the figure.
By default, the fpDoubleSingle control does not display a separator character.
If you format the control to display a separator character, but do not specify
the character to display, the control displays the separator character
specified by the international or regional Windows settings.
|
 |
|
Back to Top
You can customize the format for displaying
negative numbers. You can also let the user toggle the control’s value between
positive and negative by pressing the hyphen key or the minus key on the
numeric keypad.
By default, the fpDoubleSingle control displays a negative value as a minus
sign followed by the numeric value. You can specify that the control display
any of the formats illustrated to the right. |
 |
|
Back to Top
By default, user entry
is restricted because the fpDoubleSingle control checks each character as the
user types it or when the user pastes data into the control. If the user tries
to type or paste a character that is not valid for the control, the control
does not accept the character, and a UserError event occurs.
You can specify that the control beeps when the user types or pastes an invalid
character. You can also restrict user entry by making the control read-only or
static. You can specify that the cursor stay in the rightmost position in the
control as the user types characters.
If you prefer, you can configure the control so it does not check each
character as it is supplied, and lets the user type or paste invalid
characters. The value supplied to the fpDoubleSingle control can contain only
numbers and a decimal symbol (though the control can supply additional
formatting characters, such as a separator character).
|
|
Back to Top
You can set floating-point values using the Text
property. You can return floating-point values with or without formatting
characters. The fpDoubleSingle control maintains the decimal precision of the
control’s value until the value is edited, even if the number of decimal places
displayed is restricted.
Three properties and one function/method return the value of the control. They
differ in whether they maintain the precision and return the formatting of the
value, and whether they return the value as a string or as a number. |
 |
Text
Returns value as string with formatting, does not maintain precision
UnFmtText
Returns value as string without formatting, maintains precision
Value
Returns value as string without formatting, does not maintain precision
DoubleValue
Returns value as number without formatting, maintains precision
|
|
Back to Top
You can configure the control to display decimal
values with formatting to assist readability and consistency. You can specify
the decimal symbol, the number of digits in the decimal portion, and whether
placeholding zeros are displayed. In addition, values less than 1.0 and greater
than –1.0 can display a zero in the integer portion.
By default, the fpDoubleSingle control determines the decimal symbol, the
number of decimal digits, and whether the control displays a leading zero using
the international or regional Windows settings.
This figure illustrates a fpDoubleSingle control that displays a comma as the
decimal symbol, three digits in the decimal portion, a placeholding zero, and a
leading zero. |
 |
|
Back to Top
The fpDoubleSingle control can display buttons to
let the user quickly change the value in the control without typing. You can
choose which type of buttons to display and the amount by which the value of
the control changes when the user clicks a button.
A commonly used button style for the fpDoubleSingle control is the spin button.
By default, spin buttons increment and decrement the value of the control. You
can specify the amount by which the integer and decimal portions are changed.
To increment or decrement the integer portion, click a button when the cursor
is in the integer portion. To increment or decrement the decimal portion, click
a button when the cursor is in the decimal portion.
|
 |
|
Back to Top
NOTE: Be sure to read the Customizing User Entry section
above for information on validation of data while being entered by the user.
When the fpDoubleSingle control loses the focus, it checks
the value of the control to see whether it is valid. Valid values are defined
as numeric values, and values are limited by the settings of the MinValue
and MaxValue properties. If an invalid value is received, an InvalidData
event occurs after the control loses the focus.
You can change the fpDoubleSingle control’s appearance to reflect that it has
received invalid data. In addition, you can specify whether and how invalid
data is displayed.
You can specify whether the control allows the Null value. If the control
allows the Null value as a valid value, the control is blank when it contains
the Null value, and it displays as its background color the color specified by
the NullColor property. Otherwise, the control displays its default value,
zero. |
 |
|
|
|