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 IlvNumberField object. More... | |
Public Member Functions | |
IlvNumberField (IlvDisplay *display, const IlvPoint &point, IlDouble value, IlUShort thickness=IlvDefaultGadgetThickness, IlvPalette *palette=0) | |
Constructor. More... | |
IlvNumberField (IlvDisplay *display, const IlvPoint &point, IlInt value, IlUShort thickness=IlvDefaultGadgetThickness, IlvPalette *palette=0) | |
Constructor. More... | |
IlvNumberField (IlvDisplay *display, IlDouble value, const IlvRect &rect, IlUShort thickness=IlvDefaultGadgetThickness, IlvPalette *palette=0) | |
Constructor. More... | |
IlvNumberField (IlvDisplay *display, IlInt value, const IlvRect &rect, IlUShort thickness=IlvDefaultGadgetThickness, IlvPalette *palette=0) | |
Constructor. More... | |
virtual const char * | check (IlUShort ch) |
Is called by the interactor for each key down event that corresponds to a regular character. More... | |
char | getDecimalPointChar () const |
Returns the character used as the decimal separator. More... | |
IlBoolean | getFloatMode () const |
Indicates if the floatmode is set. More... | |
IlDouble | getFloatValue (IlBoolean &error) const |
Converts the number field value to a double value and returns this value. More... | |
IlUInt | getFormat () const |
Returns the format of the number field. More... | |
IlInt | getIntValue (IlBoolean &error) const |
Converts the number field value to an integer and returns this value. More... | |
IlDouble | getMaxFloat () const |
Returns the maximum double value set for the number field. More... | |
IlInt | getMaxInt () const |
Returns the maximum integer value defined for the number field. More... | |
IlDouble | getMinFloat () const |
Returns the minimum double value set for the number field. More... | |
IlInt | getMinInt () const |
Returns the minimum integer value set for the number field. More... | |
IlBoolean | getPadRightMode () const |
Indicates if the padright mode is set. More... | |
IlUShort | getPrecision () const |
Returns the precision defined for the number field when the float mode is set. More... | |
IlBoolean | getScientificMode () const |
Indicates if the scientific mode is set. More... | |
IlBoolean | getShowPointMode () const |
Indicates if the showpoint mode is set. More... | |
IlBoolean | getShowThousandMode () const |
Indicates if the thousands mode is set. More... | |
char | getThousandSeparator () const |
Returns the character used as the thousand separator. More... | |
void | setDecimalPointChar (char separator) |
Sets the character used as the decimal separator. More... | |
void | setFloatMode (IlBoolean val) |
Sets the floatmode on or off. More... | |
void | setFormat (IlUInt format) |
Sets the format of the number field. More... | |
void | setMaxFloat (IlDouble value) |
Sets the maximum double value of the number field. More... | |
void | setMaxInt (IlInt value) |
Sets the maximum integer value of the number field. More... | |
void | setMinFloat (IlDouble value) |
Sets the minimum double value of the number field. More... | |
void | setMinInt (IlInt value) |
Sets the minimum integer value of the number field. More... | |
void | setPadRightMode (IlBoolean val) |
Sets the padright mode on or off. More... | |
void | setPrecision (IlUShort precision) |
Sets the precision defined for the number field when the float mode is set. More... | |
void | setScientificMode (IlBoolean val) |
Sets the scientific mode on or off. More... | |
void | setShowPointMode (IlBoolean val) |
Sets the showpoint mode on or off. More... | |
void | setShowThousandMode (IlBoolean val) |
Sets the thousands mode on or off. More... | |
void | setThousandSeparator (char separator) |
Sets the character used as the thousand separator. More... | |
IlBoolean | setValue (IlDouble value, IlBoolean redraw=IlFalse) |
Sets the value of the number field to a double value. More... | |
IlBoolean | setValue (IlInt value, IlBoolean redraw=IlFalse) |
Sets the value of the number field to the specified integer. More... | |
virtual void | validate () |
Is called by the interactor when the user presses the Return or the Enter key. More... | |
Public Member Functions inherited from IlvTextField | |
IlvTextField (IlvDisplay *display, const char *label, const IlvRect &rect, IlUShort thickness=IlvDefaultGadgetThickness, IlvPalette *palette=0) | |
Constructor. More... | |
IlvTextField (IlvDisplay *display, const IlvPoint &point, const char *label, IlUShort thickness=IlvDefaultGadgetThickness, IlvPalette *palette=0) | |
Constructor. More... | |
void | addChangeCallback (IlSymbol *callbackName) |
Adds a named Label Changed callback. More... | |
void | addChangeCallback (IlSymbol *callbackName, IlAny arg) |
Adds a named Label Changed callback. More... | |
void | addChangeCallback (IlvGraphicCallback callback) |
Adds a Label Changed callback. More... | |
void | addChangeCallback (IlvGraphicCallback callback, IlAny arg) |
Adds a Label Changed callback. More... | |
void | ensureVisible (IlShort position, const IlvTransformer *t=0) |
Ensures that the character located at the specified position is visible. More... | |
IlvPosition | getAlignment () const |
Returns the alignment of the text field. More... | |
IlvGraphicCallback | getChangeCallback () const |
Returns a pointer to the first unnamed callback in the Label Changed callback list. More... | |
IlSymbol * | getChangeCallbackName () const |
Returns the name of the first named callback in the Label Changed callback list. More... | |
IlBoolean | getChangeFocusOnValidation () const |
Indicates whether the text field moves the keyboard focus to the next gadget once validated. More... | |
IlShort | getCursorPosition () const |
Returns the cursor position. More... | |
IlShort | getEndSelection () const |
Returns the index of the last selected character. More... | |
IlFloat | getFloatValue () const |
Converts the text field contents to a floating point value and returns the result of the conversion. More... | |
IlInt | getIntValue () const |
Converts the text field contents to an integer and returns the result of the conversion. More... | |
const char * | getLabel () const |
Returns the label displayed by the text field. More... | |
IlShort | getMaxChar () const |
Returns the maximum number of characters that the user can type in the text field. More... | |
virtual const char * | getMessage () const |
Returns the message displayed by this text field. More... | |
IlShort | getStartSelection () const |
Returns the index of the first selected character. More... | |
IlShort | getTextPosition () const |
Returns the index of the first visible character of the text field. More... | |
virtual IlBoolean | handleControl (IlUShort character) |
Is called by the interactor to handle control keys. More... | |
IlBoolean | isCursorShown () const |
Indicates whether the cursor is visible. More... | |
IlBoolean | isEditable () const |
Indicates whether the text field can be edited. More... | |
virtual void | labelChanged () |
Is called by the interactor whenever the label of the text field changes. More... | |
IlShort | pointToPosition (const IlvPoint &point, const IlvTransformer *t=0) const |
Returns the index of the character located at the specified point. More... | |
virtual void | removeSelection () |
Removes the selected label from the text field. More... | |
void | setAlignment (IlvPosition alignment) |
Sets the alignment of the text field. More... | |
void | setChangeCallback (IlSymbol *callbackName) |
Sets a named Label Changed callback. More... | |
void | setChangeCallback (IlSymbol *callbackName, IlAny arg) |
Sets a named Label Changed callback. More... | |
void | setChangeCallback (IlvGraphicCallback callback) |
Sets a Label Changed callback. More... | |
void | setChangeCallback (IlvGraphicCallback callback, IlAny arg) |
Sets a Label Changed callback. More... | |
void | setChangeFocusOnValidation (IlBoolean value) |
Specifies whether the text field should move the keyboard focus to the next gadget once validated. More... | |
void | setCursorPosition (IlShort position) |
Sets the cursor position. More... | |
void | setEditable (IlBoolean value) |
Specifies whether the text field can be edited. More... | |
void | setEndSelection (IlShort position) |
Sets the index of the last selected character. More... | |
virtual void | setLabel (const char *label, IlBoolean redraw=IlFalse) |
Sets the label of the text field. More... | |
void | setMaxChar (IlShort count) |
Sets the maximum number of characters that the user can type in the text field. More... | |
void | setSelection (IlShort start, IlShort end) |
Selects a portion of the text field content. More... | |
void | setStartSelection (IlShort position) |
Sets the index of the first selected character. More... | |
void | setTextPosition (IlShort position) |
Sets the index of the first visible character of the text field. More... | |
void | setValue (IlFloat value, const char *format=0, IlBoolean redraw=IlFalse) |
Sets the text field label to a floating-point value. More... | |
void | setValue (IlInt value, IlBoolean redraw=IlFalse) |
Sets the text field label to an integer value. More... | |
void | showCursor (IlBoolean value, IlBoolean redraw=IlFalse) |
Specifies whether the cursor should be visible. More... | |
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.
IlvPasswordTextField
, IlvDateField
.Name | Type | Equivalent methods |
---|---|---|
floatMode | Boolean | getFloatMode() , setFloatMode() |
scientificMode | Boolean | getScientificMode() , setScientificMode() |
padright | Boolean | getPadRightMode() , setPadRightMode() |
showPoint | Boolean | getShowPointMode() , setShowPointMode() |
showThousand | Boolean | getShowThousandMode() , setShowThousandMode() |
thousandSeparator | String | getThousandSeparator() , setThousandSeparator() |
decimalPoint | String | getDecimalPointChar() , setDecimalPointChar() |
precision | UInt | getPrecision() , setPrecision() |
intValue | Int | getIntValue() , setValue(IlInt, IlBoolean) |
minInt | Int | getMinInt() , setMinInt() |
maxInt | Int | getMaxInt() , setMaxInt() |
floatValue | Double | getFloatValue() , setValue(IlDouble, IlBoolean) |
minFloat | Double | getMinFloat() , setMinFloat() |
maxFloat | Double | getMaxFloat() , setMaxFloat() |
Graphic property | CSS property | Type |
---|---|---|
Background color | background-color | Color |
Text color | color | Color |
This enumeration defines the possible values for the mode of an IlvNumberField
object.
IlvNumberField::setFormat()
. 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 |
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. |
setLabel()
. Reimplemented from IlvTextField.
char IlvNumberField::getDecimalPointChar | ( | ) | const |
Returns the character used as the decimal separator.
setDecimalPointChar()
. IlBoolean IlvNumberField::getFloatMode | ( | ) | const |
Indicates if the floatmode
is set.
IlTrue
if the floatmode
is set, and IlFalse
otherwise. Converts the number field value to a double value and returns this value.
error | Specifies 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.
The format is a bitwise OR
combination of IlvNumberFieldFormat
values.
IlvNumberFieldFormat
, setFormat()
. Converts the number field value to an integer and returns this value.
error | Specifies 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.
getMinFloat()
, setMaxFloat()
. 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.
getMinInt()
, setMaxInt()
. 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.
getMaxFloat()
, setMinFloat()
. 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.
getMaxInt()
, setMinInt()
. IlBoolean IlvNumberField::getPadRightMode | ( | ) | const |
Indicates if the padright
mode is set.
IlTrue
if both floatmode
and padright
mode are set, and IlFalse
otherwise. 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.
IlvNumberFieldFormat
, setPrecision
. IlBoolean IlvNumberField::getScientificMode | ( | ) | const |
Indicates if the scientific
mode is set.
IlTrue
if both floatmode
and scientific
mode are set, and IlFalse
otherwise. IlBoolean IlvNumberField::getShowPointMode | ( | ) | const |
Indicates if the showpoint
mode is set.
IlTrue
if both floatmode
and showpoint
mode are set, and IlFalse
otherwise. IlBoolean IlvNumberField::getShowThousandMode | ( | ) | const |
Indicates if the thousands
mode is set.
IlTrue
if the thousands
mode is set, and IlFalse
otherwise. char IlvNumberField::getThousandSeparator | ( | ) | const |
Returns the character used as the thousand separator.
setThousandSeparator()
. void IlvNumberField::setDecimalPointChar | ( | char | separator | ) |
Sets the character used as the decimal separator.
separator | The decimal separator to be used. |
IlvNumberFieldFormat
, getDecimalPointChar()
. void IlvNumberField::setFloatMode | ( | IlBoolean | val | ) |
Sets the floatmode
on or off.
The method does nothing if floatmode
is already in the requested state. Otherwise, the method sets floatmode
and calls setValue(IlInt)
or setValue(IlDouble)
, which recomputes the numerical value according to the new setting.
val | IlTrue to set to set floatmode on, IlFalse to set it off. |
void IlvNumberField::setFormat | ( | IlUInt | format | ) |
Sets the format of the number field.
The format is a bitwise OR
combination of IlvNumberFieldFormat
values.
format | The new format. |
IlvNumberFieldFormat
, getFormat()
. 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. |
getMaxFloat()
, getMinFloat()
. 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. |
getMaxInt()
, getMinInt()
. 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. |
getMinFloat()
, getMaxFloat()
. 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. |
getMinInt()
, getMaxInt()
. void IlvNumberField::setPadRightMode | ( | IlBoolean | val | ) |
Sets the padright
mode on or off.
The method does nothing if floatmode
is off or if padright
mode is already in the requested state. Otherwise, the method sets padright
mode and calls setValue(IlInt)
or setValue(IlDouble)
, which recomputes the numerical value according to the new setting.
val | IlTrue to set to set padright mode on, IlFalse to set it off. |
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. |
IlvNumberFieldFormat
, getPrecision()
. void IlvNumberField::setScientificMode | ( | IlBoolean | val | ) |
Sets the scientific
mode on or off.
The method does nothing if floatmode
is off or if scientific
mode is already in the requested state. Otherwise, the method sets scientific
mode and calls setValue(IlInt)
or setValue(IlDouble)
, which recomputes the numerical value according to the new setting.
val | IlTrue to set to set scientific mode on, IlFalse to set it off. |
void IlvNumberField::setShowPointMode | ( | IlBoolean | val | ) |
Sets the showpoint
mode on or off.
The method does nothing if floatmode
is off or if showpoint
mode is already in the requested state. Otherwise, the method sets showpoint
mode and calls setValue(IlInt)
or setValue(IlDouble)
, which recomputes the numerical value according to the new setting.
val | IlTrue to set to set showpoint mode on, IlFalse to set it off. |
void IlvNumberField::setShowThousandMode | ( | IlBoolean | val | ) |
Sets the thousands
mode on or off.
The method does nothing if thousands
mode is already in the requested state. Otherwise, the method sets thousands
mode and calls setValue(IlInt)
or setValue(IlDouble)
, which recomputes the numerical value according to the new setting.
val | IlTrue to set to set thousands mode on, IlFalse to set it off. |
void IlvNumberField::setThousandSeparator | ( | char | separator | ) |
Sets the character used as the thousand separator.
separator | The thousand separator to be used. |
IlvNumberFieldFormat
, getFormat()
. 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 | Specifies whether the number field should be redrawn. |
IlTrue
if the operation succeeded, IlFalse
otherwise. getFloatValue()
, setValue(IlInt, IlBoolean)
, setFormat()
. 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 | Specifyies whether the number field should be redrawn. |
IlTrue
if the operation succeeded and IlFalse
otherwise.
|
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.