rwlogo
Rogue Wave Views 5.6

Rogue Wave Views
Gadgets Package API Reference Guide

Product Documentation:

Rogue Wave Views
Documentation Home

IlvNumberField Class Reference

Gadget class. More...

#include <ilviews/gadgets/numfield.h>

Inheritance diagram for IlvNumberField:
IlvTextField IlvGadget IlvSimpleGraphic IlvGraphic

List of all members.

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.
 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.

Detailed Description

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.

See also:
IlvPasswordTextField, IlvDateField

Member Enumeration Documentation

This enumeration defines the possible values for the mode of an IlvNumberField object.

See also:
IlvNumberField::setFormat
Enumerator:
thousands 

Displays thousand separators.

scientific 

Displays double values with an exponent notation. This mode only works when the floatmode is set.

padright 

Adds trailing zeros after the decimal point. This mode only works when the floatmode is set.

showpoint 

Always shows the decimal separator. This mode only works when the floatmode is set.

floatmode 

Displays the field as a decimal value.


Constructor & Destructor Documentation

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.

Parameters:
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.

Parameters:
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.

Parameters:
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.

Parameters:
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.

Member Function Documentation

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).

Parameters:
character The ASCII code of the character.
Returns:
The new label of the text field.
See also:
setLabel

Reimplemented from IlvTextField.

char IlvNumberField::getDecimalPointChar (  )  const

Returns the character used as the decimal separator.

Returns:
The character used as the decimal separator.
See also:
setDecimalPointChar
IlDouble IlvNumberField::getFloatValue ( IlBoolean error  )  const

Converts the number field value to a double value and returns this value.

Parameters:
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.
Returns:
The value of the number field converted to a double value. The return value is undefined if error is IlTrue.
See also:
IlvNumberFieldFormat, setValue(IlDouble, IlBoolean), setMinFloat, setMaxFloat, setFormat
IlUInt IlvNumberField::getFormat (  )  const

Returns the format of the number field.

Returns:
The format of the number field.
See also:
IlvNumberFieldFormat, setFormat
IlInt IlvNumberField::getIntValue ( IlBoolean error  )  const

Converts the number field value to an integer and returns this value.

Parameters:
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.
Returns:
The number field value converted to an integer value. The return value is undefined if error is IlTrue.
See also:
IlvNumberFieldFormat, setValue(IlInt, IlBoolean), setMinInt, setMaxInt
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.

Returns:
The maximum double value set for the number field.
See also:
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.

Returns:
The maximum integer value of the number field.
See also:
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.

Returns:
The minimum double value set for the number field.
See also:
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.

Returns:
The minimum integer value set for the number field.
See also:
getMaxInt, setMinInt
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.

Returns:
The precision of the number field when the float mode is set.
See also:
IlvNumberFieldFormat, setPrecision
char IlvNumberField::getThousandSeparator (  )  const

Returns the character used as the thousand separator.

Returns:
The character used as the thousand separator.
See also:
setThousandSeparator
void IlvNumberField::setDecimalPointChar ( char  separator  ) 

Sets the character used as the decimal separator.

Parameters:
separator The decimal separator to be used.
See also:
IlvNumberFieldFormat, getDecimalPointChar
void IlvNumberField::setFormat ( IlUInt  format  ) 

Sets the format of the number field.

Parameters:
format The new format.
See also:
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.

Parameters:
value The maximum double value.
See also:
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.

Parameters:
value The maximum integer value.
See also:
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.

Parameters:
value The minimum double value.
See also:
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.

Parameters:
value The minimum integer value.
See also:
getMinInt, getMaxInt
void IlvNumberField::setPrecision ( IlUShort  precision  ) 

Sets the precision defined for the number field when the float mode is set.

Parameters:
precision The precision to be used.
See also:
IlvNumberFieldFormat, getPrecision
void IlvNumberField::setThousandSeparator ( char  separator  ) 

Sets the character used as the thousand separator.

Parameters:
separator The thousand separator to be used.
See also:
IlvNumberFieldFormat, getFormat
IlBoolean IlvNumberField::setValue ( IlDouble  value,
IlBoolean  redraw = IlFalse 
)

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 ).

Parameters:
value The number field double value.
redraw A Boolean value specifying whether the number field should be redrawn.
Returns:
IlTrue if the operation succeeded, IlFalse otherwise.
See also:
getFloatValue, setValue(IlInt, IlBoolean), setFormat
IlBoolean IlvNumberField::setValue ( IlInt  value,
IlBoolean  redraw = IlFalse 
)

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).

Parameters:
value The number field integer value.
redraw A Boolean value specifying whether the number field should be redrawn.
Returns:
IlTrue if the operation succeeded and IlFalse otherwise.
See also:
getIntValue, setValue(IlDouble, IlBoolean), setFormat

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.

See also:
getChangeFocusOnValidation, IlvGraphicHolder::setFocus

Reimplemented from IlvTextField.

 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

© 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.