Rogue Wave Views 5.6 |
Rogue Wave Views |
Rogue Wave Views Documentation Home |
Gadget class. More...
#include <ilviews/gadgets/numfield.h>
Public Types | |
enum | IlvNumberFieldFormat { thousands, scientific, padright, showpoint, floatmode } |
This enumeration defines the possible values for the mode of an | |
Public Member Functions | |
IlvNumberField (IlvDisplay *display, const IlvPoint &point, IlDouble value, IlUShort thickness=IlvDefaultGadgetThickness, IlvPalette *palette=0) | |
Constructor. | |
IlvNumberField (IlvDisplay *display, const IlvPoint &point, IlInt value, IlUShort thickness=IlvDefaultGadgetThickness, IlvPalette *palette=0) | |
Constructor. | |
IlvNumberField (IlvDisplay *display, IlDouble value, const IlvRect &rect, IlUShort thickness=IlvDefaultGadgetThickness, IlvPalette *palette=0) | |
Constructor. | |
IlvNumberField (IlvDisplay *display, IlInt value, const IlvRect &rect, IlUShort thickness=IlvDefaultGadgetThickness, IlvPalette *palette=0) | |
Constructor. | |
virtual const char * | check (IlUShort ch) |
Is called by the interactor for each key down event that corresponds to a regular character. | |
char | getDecimalPointChar () const |
Returns the character used as the decimal separator. | |
IlDouble | getFloatValue (IlBoolean &error) const |
Converts the number field value to a double value and returns this value. | |
IlUInt | getFormat () const |
Returns the format of the number field. | |
IlInt | getIntValue (IlBoolean &error) const |
Converts the number field value to an integer and returns this value. | |
IlDouble | getMaxFloat () const |
Returns the maximum double value set for the number field. | |
IlInt | getMaxInt () const |
Returns the maximum integer value defined for the number field. | |
IlDouble | getMinFloat () const |
Returns the minimum double value set for the number field. | |
IlInt | getMinInt () const |
Returns the minimum integer value set for the number field. | |
IlUShort | getPrecision () const |
Returns the precision defined for the number field when the float mode is set. | |
char | getThousandSeparator () const |
Returns the character used as the thousand separator. | |
void | setDecimalPointChar (char separator) |
Sets the character used as the decimal separator. | |
void | setFormat (IlUInt format) |
Sets the format of the number field. | |
void | setMaxFloat (IlDouble value) |
Sets the maximum double value of the number field. | |
void | setMaxInt (IlInt value) |
Sets the maximum integer value of the number field. | |
void | setMinFloat (IlDouble value) |
Sets the minimum double value of the number field. | |
void | setMinInt (IlInt value) |
Sets the minimum integer value of the number field. | |
void | setPrecision (IlUShort precision) |
Sets the precision defined for the number field when the float mode is set. | |
void | setThousandSeparator (char separator) |
Sets the character used as the thousand separator. | |
IlBoolean | setValue (IlDouble value, IlBoolean redraw=IlFalse) |
Sets the value of the number field to a double value. | |
IlBoolean | setValue (IlInt value, IlBoolean redraw=IlFalse) |
Sets the value of the number field to the specified integer. | |
virtual void | validate () |
Is called by the interactor when the user presses the Return or the Enter key. |
Gadget class.
Library: ilvgadgt
The IlvNumberField
class is a subclass of IlvTextField
defining a specialized text field that accommodates numeric values with various formats. It lets you specify the minimum and maximum values allowed in the number field. The validate callback is invoked only if the field contains a numeric value and this number is between the specified limits.
This enumeration defines the possible values for the mode of an IlvNumberField
object.
IlvNumberField::IlvNumberField | ( | IlvDisplay * | display, | |
IlInt | value, | |||
const IlvRect & | rect, | |||
IlUShort | thickness = IlvDefaultGadgetThickness , |
|||
IlvPalette * | palette = 0 | |||
) |
Constructor.
Initializes a new instance of the IlvNumberField
class that accommodates an integer value.
display | The connection to the display. | |
value | The integer value. | |
rect | The size and position of the number field. | |
thickness | The thickness of the number field. | |
palette | The palette used to draw the number field. |
IlvNumberField::IlvNumberField | ( | IlvDisplay * | display, | |
IlDouble | value, | |||
const IlvRect & | rect, | |||
IlUShort | thickness = IlvDefaultGadgetThickness , |
|||
IlvPalette * | palette = 0 | |||
) |
Constructor.
Initializes a new instance of the IlvNumberField
class that accommodates a double value.
display | The connection to the display. | |
value | The double value. | |
rect | The size and position of the number field. | |
thickness | The thickness of the number field. | |
palette | The palette used to draw the number field. |
IlvNumberField::IlvNumberField | ( | IlvDisplay * | display, | |
const IlvPoint & | point, | |||
IlInt | value, | |||
IlUShort | thickness = IlvDefaultGadgetThickness , |
|||
IlvPalette * | palette = 0 | |||
) |
Constructor.
Initializes a new instance of the IlvNumberField
class that accommodates an integer value. The size of the number field is computed with the value parameter. If you want to give the number field a specific size, use a constructor that takes an IlvRect
reference instead of an IlvPoint
object as parameter.
display | The connection to the display. | |
point | The position of the number field. | |
value | The integer value. | |
thickness | The thickness of the number field. | |
palette | The palette used to draw the number field. |
IlvNumberField::IlvNumberField | ( | IlvDisplay * | display, | |
const IlvPoint & | point, | |||
IlDouble | value, | |||
IlUShort | thickness = IlvDefaultGadgetThickness , |
|||
IlvPalette * | palette = 0 | |||
) |
Constructor.
Initializes a new instance of the IlvNumberfield
class that accommodates a double value. The size of the number field is computed with the value parameter. If you want the number field to have a specific size, use a constructor that takes an IlvRect
reference instead of an IlvPoint
object as parameter.
display | The connection to the display. | |
point | The position of the number field. | |
value | The double value. | |
thickness | The thickness of the number field. | |
palette | The palette used to draw the number field. |
virtual const char* IlvNumberField::check | ( | IlUShort | character | ) | [virtual] |
Is called by the interactor for each key down event that corresponds to a regular character.
The default implementation inserts character in the text field (erasing the selection if there is one).
character | The ASCII code of the character. |
Reimplemented from IlvTextField.
char IlvNumberField::getDecimalPointChar | ( | ) | const |
Returns the character used as the decimal separator.
Converts the number field value to a double value and returns this value.
error | A Boolean value specifying whether an error occurred when trying to convert the number field value to a double value: error is set to IlTrue if the float mode is not set, if the value is outside the specified limits (see IlvNumberField::setMinFloat , IlvNumberField::setMaxFloat ), or if the value in the number field is not a number. |
IlTrue
. IlUInt IlvNumberField::getFormat | ( | ) | const |
Returns the format of the number field.
Converts the number field value to an integer and returns this value.
error | A Boolean value specifying whether an error occurred when trying to convert the number field value to an integer: error is set to IlTrue if the float mode is set, if the value is outside the specified limits (see IlvNumberField::setMinInt , IlvNumberField::setMaxInt ), or if the value in the number field is not a number. |
IlTrue
. IlDouble IlvNumberField::getMaxFloat | ( | ) | const |
Returns the maximum double value set for the number field.
Note that the minimum and maximum values are tested when IlvNumberField::getFloatValue
and IlvNumberField::setValue(IlDouble, IlBoolean)
are called.
IlInt IlvNumberField::getMaxInt | ( | ) | const |
Returns the maximum integer value defined for the number field.
Note that the minimum and maximum values are tested when IlvNumberField::getIntValue
and IlvNumberField::setValue(IlInt, IlBoolean)
are called.
IlDouble IlvNumberField::getMinFloat | ( | ) | const |
Returns the minimum double value set for the number field.
Note that the minimum and maximum values are tested when IlvNumberField::getFloatValue
and IlvNumberField::setValue(IlDouble, IlBoolean)
are called.
IlInt IlvNumberField::getMinInt | ( | ) | const |
Returns the minimum integer value set for the number field.
Note that the minimum and maximum values are tested when IlvNumberField::getIntValue
and IlvNumberField::setValue(IlInt, IlBoolean)
are called.
IlUShort IlvNumberField::getPrecision | ( | ) | const |
Returns the precision defined for the number field when the float mode is set.
The precision is the number of digits after the decimal point. The default value is 6. A precision of 0
is supported only when the scientific mode is not set.
char IlvNumberField::getThousandSeparator | ( | ) | const |
Returns the character used as the thousand separator.
void IlvNumberField::setDecimalPointChar | ( | char | separator | ) |
Sets the character used as the decimal separator.
separator | The decimal separator to be used. |
void IlvNumberField::setFormat | ( | IlUInt | format | ) |
Sets the format of the number field.
format | The new format. |
void IlvNumberField::setMaxFloat | ( | IlDouble | value | ) |
Sets the maximum double value of the number field.
Note that the minimum and maximum values are tested when IlvNumberField::getFloatValue
and IlvNumberField::setValue(IlDouble, IlBoolean)
are called.
value | The maximum double value. |
void IlvNumberField::setMaxInt | ( | IlInt | value | ) |
Sets the maximum integer value of the number field.
Note that the minimum and maximum values are tested when IlvNumberField::getIntValue
and IlvNumberField::setValue(IlInt, IlBoolean)
are called.
value | The maximum integer value. |
void IlvNumberField::setMinFloat | ( | IlDouble | value | ) |
Sets the minimum double value of the number field.
Note that the minimum and maximum values are tested when IlvNumberField::getFloatValue
and IlvNumberField::setValue(IlDouble, IlBoolean)
are called.
value | The minimum double value. |
void IlvNumberField::setMinInt | ( | IlInt | value | ) |
Sets the minimum integer value of the number field.
Note that the minimum and maximum values are tested when IlvNumberField::getIntValue
and IlvNumberField::setValue(IlInt, IlBoolean)
are called.
value | The minimum integer value. |
void IlvNumberField::setPrecision | ( | IlUShort | precision | ) |
Sets the precision defined for the number field when the float mode is set.
precision | The precision to be used. |
void IlvNumberField::setThousandSeparator | ( | char | separator | ) |
Sets the character used as the thousand separator.
separator | The thousand separator to be used. |
Sets the value of the number field to a double value.
Does nothing if the float mode is not set or if value is outside the specified limits (see IlvNumberField::setMinFloat
, IlvNumberField::setMaxFloat
).
value | The number field double value. | |
redraw | A Boolean value specifying whether the number field should be redrawn. |
IlTrue
if the operation succeeded, IlFalse
otherwise. Sets the value of the number field to the specified integer.
Does nothing if the float mode is set or if value is outside the specified limits (see IlvNumberField::setMinInt
, IlvNumberField::setMaxInt
).
value | The number field integer value. | |
redraw | A Boolean value specifying whether the number field should be redrawn. |
IlTrue
if the operation succeeded and IlFalse
otherwise. Reimplemented from IlvTextField.
virtual void IlvNumberField::validate | ( | ) | [virtual] |
Is called by the interactor when the user presses the Return or the Enter key.
The default implementation invokes the main callback of the text field. If the method IlvTextField::getChangeFocusOnValidation
returns IlTrue
, the keyboard focus moves to the next gadget in the focus chain.
Reimplemented from IlvTextField.
© Copyright 2012, Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.