Class NumericText
Object
|
+--Widget
|
+--Text
|
+--ValidatingText
|
+--NumericText
- class
NumericText
- extends ValidatingText
Defined in form_widgets.js
Fields inherited from class Text |
|
Constructor Summary |
NumericText
(<boolean> onlyIntegers, <number> lowerBound, <number> upperBound, <boolean> setMaxLength)
Creates a text widget that will force the user to only enter valid numeric
strings.
|
Method Summary |
number
|
getMaximum()
Returns the current maximum acceptable value for this text box.
|
number
|
getMinimum()
Returns the current minimum acceptable value for this text box.
|
boolean
|
isIntegerOnly()
Returns true if this text box only accepts integers, and
false otherwise.
|
void
|
setBounds(<number> min, <number> max, <boolean> updateTextLength)
Sets the bounds of this text box to [min, max] .
|
<static> function
|
makePrototypes()
|
Methods inherited from class Widget |
installContextMenu, installDefaultContextMenu, uninstallContextMenu, isDraggable, setDraggable, addEventListener, blur, createEventTable, dispose, focus, getAbsoluteBottom, getAbsoluteLeft, getAbsoluteRight, getAbsoluteTop, getBottom, getBounds, getClientHeight, getClientWidth, getCorner, getHeight, getLeft, getPixelsPerEm, getRight, getToolTip, getTop, getWidth, isDisposed, isEnabled, layout, moveToAbsolute, moveTo, raiseEvent, registerEventType, removeEventListener, setAbsoluteBottom, setAbsoluteLeft, setAbsoluteRight, setAbsoluteTop, setBottom, setEnabled, setHeight, setLeft, setRight, setToolTip, setTop, setWidth, setParent, toString
|
NumericText
function NumericText(<boolean> onlyIntegers, <number> lowerBound, <number> upperBound, <boolean> setMaxLength)
Creates a text widget that will force the user to only enter valid numeric
strings. If onlyIntegers
is true
, then input will
be further restricted to valid integer string. lowerBound
and
upperBound
are the lower and upper bounds, respectively, on the
acceptable numeric values. Note that the bounds are inclusive, and that
lowerBound
must be less than or equal to
upperBound
.
Parameters:
onlyIntegers
- (Optional) - a flag indicating whether or not to restrict input to valid integers. Defaults to false
.
lowerBound
- (Optional) - the minimum acceptable value. Defaults to Number.NEGATIVE_INFINITY
.
upperBound
- (Optional) - the maximum acceptable value. Defaults to Number.POSITIVE_INFINITY
.
setMaxLength
- (Optional) - if true
, the optimum maximum text length for this widget will be calculated and set, as if by setMaxLength()
. Defaults to false
.
getMaximum
number getMaximum()
Returns the current maximum acceptable value for this text box.
Returns:
the text box's current maximum
getMinimum
number getMinimum()
Returns the current minimum acceptable value for this text box.
Returns:
the text box's current minimum
isIntegerOnly
boolean isIntegerOnly()
Returns true
if this text box only accepts integers, and
false
otherwise.
Returns:
a boolean indicating whether or not this text box is limited to integers
setBounds
void setBounds(<number> min, <number> max, <boolean> updateTextLength)
Sets the bounds of this text box to [min, max]
. If
min
is not provided, or is not numeric, then it will
default to Number.NEGATIVE_INFINITY
. If max
is not provided, or is not numeric, then it will default to
Number.POSITIVE_INFINITY
.
Parameters:
min
- (Optional) - the new minimum accepted value for this text box. Defaults to Number.NEGATIVE_INFINITY
.
max
- (Optional) - the new maximum accepted value for this text box. Defaults to Number.POSITIVE_INFINITY
.
updateTextLength
- (Optional) - a flag to indicate whether or not to update the text widget's maximum text length after updating the bounds. If true
, the maximum number of digits required to express the entire valid range is calculated and setMaxLength()
is called with that value. If false
, the maximum length is left unchanged. Defaults to false
.
makePrototypes
<static> function makePrototypes()
