Table Of Contents

Previous topic

NumberUpdatedEvent

Next topic

NumCtrlAccessorsMixin

This Page

phoenix_title NumCtrl

Masked edit control supporting “native” numeric values, ie. .SetValue(3), for example, and supporting a variety of formatting options, including automatic rounding specifiable precision, grouping and decimal place characters, etc.


class_hierarchy Inheritance Diagram

Inheritance diagram for class NumCtrl

Inheritance diagram of NumCtrl


method_summary Methods Summary

__init__  
ChangeValue Sets the value of the control to the value specified.
GetAllowNegative (For regularization of property accessors)
GetAllowNone (For regularization of property accessors)
GetAutoSize  
GetBounds This function returns a two-tuple (min,max), indicating the
GetDecimalChar  
GetFraction Returns the fractional portion of the value as a float. If there is no
GetFractionWidth  
GetGroupChar  
GetGroupDigits (For regularization of property accessors)
GetIntegerWidth  
GetLimited (For regularization of property accessors)
GetLimitOnFieldChange (For regularization of property accessors)
GetMax Gets the maximum value of the control. It will return the current
GetMin Gets the lower bound value of the control. It will return
GetSelectOnEntry  
GetValue Returns the current numeric value of the control.
IsGroupingAllowed  
IsInBounds Returns True if no value is specified and the current value
IsLimited Returns True if the control is currently limiting the
IsLimitedOnFieldChange Returns True if the control is currently limiting the
IsNegativeAllowed  
IsNoneAllowed  
OnTextChange Handles an event indicating that the text control’s value
SetAllowNegative  
SetAllowNone Change the behavior of the validation code, allowing control
SetAutoSize  
SetBounds This function is a convenience function for setting the min and max
SetDecimalChar  
SetFractionWidth  
SetGroupChar  
SetGroupDigits  
SetIntegerWidth  
SetLimited If called with a value of True, this function will cause the control
SetLimitOnFieldChange If called with a value of True, this function will cause the control
SetMax Sets the maximum value of the control. If a value of None
SetMin Sets the minimum value of the control. If a value of None
SetParameters This function is used to initialize and reconfigure the control.
SetSelectOnEntry  
SetValue Sets the value of the control to the value specified.

api Class API



class NumCtrl(BaseMaskedTextCtrl, NumCtrlAccessorsMixin)

Masked edit control supporting “native” numeric values, ie. .SetValue(3), for example, and supporting a variety of formatting options, including automatic rounding specifiable precision, grouping and decimal place characters, etc.


Methods



__init__(self, parent, id=-1, value = 0, pos = DefaultPosition, size = DefaultSize, style = TE_PROCESS_TAB, validator = DefaultValidator, name = "masked.num", **kwargs)


ChangeValue(self, value)

Sets the value of the control to the value specified. The resulting actual value of the control may be altered to conform with the bounds set on the control if limited, or colored if not limited but the value is out-of-bounds. A ValueError exception will be raised if an invalid value is specified.



GetAllowNegative(self)

(For regularization of property accessors)



GetAllowNone(self)

(For regularization of property accessors)



GetAutoSize(self)


GetBounds(self)

This function returns a two-tuple (min,max), indicating the current bounds of the control. Each value can be None if that bound is not set.



GetDecimalChar(self)


GetFraction(self, candidate=None)

Returns the fractional portion of the value as a float. If there is no fractional portion, the value returned will be 0.0.



GetFractionWidth(self)


GetGroupChar(self)


GetGroupDigits(self)

(For regularization of property accessors)



GetIntegerWidth(self)


GetLimited(self)

(For regularization of property accessors)



GetLimitOnFieldChange(self)

(For regularization of property accessors)



GetMax(self)

Gets the maximum value of the control. It will return the current maximum integer, or None if not specified.



GetMin(self)

Gets the lower bound value of the control. It will return None if not specified.



GetSelectOnEntry(self)


GetValue(self)

Returns the current numeric value of the control.



IsGroupingAllowed(self)


IsInBounds(self, value=None)

Returns True if no value is specified and the current value of the control falls within the current bounds. This function can also be called with a value to see if that value would fall within the current bounds of the given control.



IsLimited(self)

Returns True if the control is currently limiting the value to fall within the current bounds.



IsLimitedOnFieldChange(self)

Returns True if the control is currently limiting the value to fall within the current bounds.



IsNegativeAllowed(self)


IsNoneAllowed(self)


OnTextChange(self, event)

Handles an event indicating that the text control’s value has changed, and issue EVT_NUM event. NOTE: using wxTextCtrl.SetValue() to change the control’s contents from within a EVT_CHAR handler can cause double text events. So we check for actual changes to the text before passing the events on.



SetAllowNegative(self, value)


SetAllowNone(self, allow_none)

Change the behavior of the validation code, allowing control to have a value of None or not, as appropriate. If the value of the control is currently None, and allow_none is False, the value of the control will be set to the minimum value of the control, or 0 if no lower bound is set.



SetAutoSize(self, value)


SetBounds(self, min=None, max=None)

This function is a convenience function for setting the min and max values at the same time. The function only applies the maximum bound if setting the minimum bound is successful, and returns True only if both operations succeed. NOTE: leaving out an argument will remove the corresponding bound.



SetDecimalChar(self, value)


SetFractionWidth(self, value)


SetGroupChar(self, value)


SetGroupDigits(self, value)


SetIntegerWidth(self, value)


SetLimited(self, limited)

If called with a value of True, this function will cause the control to limit the value to fall within the bounds currently specified. If the control’s value currently exceeds the bounds, it will then be limited accordingly.

If called with a value of False, this function will disable value limiting, but coloring of out-of-bounds values will still take place if bounds have been set for the control.



SetLimitOnFieldChange(self, limit)

If called with a value of True, this function will cause the control to prevent navigation out of the current field if its value is out-of-bounds, and limit the value to fall within the bounds currently specified if the control loses focus.

If called with a value of False, this function will disable value limiting, but coloring of out-of-bounds values will still take place if bounds have been set for the control.



SetMax(self, max=None)

Sets the maximum value of the control. If a value of None is provided, then the control will have no explicit maximum value. If the value specified is less than the current minimum value, then the function returns False and the maximum will not change from its current setting. On success, the function returns True.

If successful and the current value is greater than the new upper bound, if the control is limited the value will be automatically adjusted to this maximum value; if not limited, the value in the control will be colored as invalid.

If max > the max value allowed by the width of the control, the function will return False, and the max will not be set.



SetMin(self, min=None)

Sets the minimum value of the control. If a value of None is provided, then the control will have no explicit minimum value. If the value specified is greater than the current maximum value, then the function returns False and the minimum will not change from its current setting. On success, the function returns True.

If successful and the current value is lower than the new lower bound, if the control is limited, the value will be automatically adjusted to the new minimum value; if not limited, the value in the control will be colored as invalid.

If min > the max value allowed by the width of the control, the function will return False, and the min will not be set.



SetParameters(self, **kwargs)

This function is used to initialize and reconfigure the control. See TimeCtrl module overview for available parameters.



SetSelectOnEntry(self, value)


SetValue(self, value)

Sets the value of the control to the value specified. The resulting actual value of the control may be altered to conform with the bounds set on the control if limited, or colored if not limited but the value is out-of-bounds. A ValueError exception will be raised if an invalid value is specified.