Phoenix Logo

phoenix_title wx.lib.intctrl.IntValidator

Validator class used with IntCtrl handles all validation of input prior to changing the value of the underlying TextCtrl.


class_hierarchy Class Hierarchy

Inheritance diagram for class IntValidator:


super_classes Known Superclasses

wx.Validator


method_summary Methods Summary

__init__ Standard constructor
Clone Standard cloner
OnChar Validates keystrokes to make sure the resulting value will a legal
TransferFromWindow Transfer data from window to validator.
TransferToWindow Transfer data from validator to window.
Validate Because each operation on the control is vetted as it’s made,

api Class API



class IntValidator(wx.Validator)

Validator class used with IntCtrl handles all validation of input prior to changing the value of the underlying TextCtrl.


Methods



__init__(self)

Standard constructor



Clone(self)

Standard cloner

..note::
Every validator must implement the Clone() method.


OnChar(self, event)

Validates keystrokes to make sure the resulting value will a legal value. Erasing the value causes it to be set to 0, with the value selected, so it can be replaced. Similarly, replacing the value with a ‘-‘ sign causes the value to become -1, with the value selected. Leading zeros are removed if introduced by selection, and are prevented from being inserted.



TransferFromWindow(self)

Transfer data from window to validator.

The default implementation returns False, indicating that an error occurred. We simply return True, to indicate to e.g. Dialog that all is well.

If data comes e.g. from a database then you need to override this.



TransferToWindow(self)

Transfer data from validator to window.

The default implementation returns False, indicating that an error occurred. We simply return True, to indicate to e.g. Dialog that all is well.

If data comes e.g. from a database then you need to override this.



Validate(self, window)

Because each operation on the control is vetted as it’s made, the value of the control is always valid.