.. wxPython Phoenix documentation

   This file was generated by Phoenix's sphinx generator and associated
   tools, do not edit by hand.

   Copyright: (c) 2011-2020 by Total Control Software
   License:   wxWindows License

.. include:: headings.inc

.. currentmodule:: wx.lib.intctrl

.. highlight:: python



.. _wx.lib.intctrl.IntValidator:

==========================================================================================================================================
|phoenix_title|  **wx.lib.intctrl.IntValidator**
==========================================================================================================================================

Validator class used with :class:`~lib.intctrl.IntCtrl` handles all validation of
input prior to changing the value of the underlying :class:`TextCtrl`.



|

|class_hierarchy| Class Hierarchy
=================================

.. raw:: html

   <div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
   <img id="toggleBlock-trigger" src="_static/images/closed.png"/>
   Inheritance diagram for class <strong>IntValidator</strong>:
   </div>
   <div id="toggleBlock-summary" style="display:block;"></div>
   <div id="toggleBlock-content" style="display:none;">
   <p class="graphviz">
   <center><img src="_static/images/inheritance/wx.lib.intctrl.IntValidator_inheritance.svg" alt="Inheritance diagram of IntValidator" usemap="#dummy" class="inheritance"/></center>
   <script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
   <map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.lib.intctrl.IntValidator.html" title="Validator class used with lib.intctrl.IntCtrl handles all validation of" alt="" coords="24,236,219,265"/> <area shape="rect" id="node2" href="wx.Validator.html" title="wx.Validator  is the base class for a family of validator classes that mediate between a class of control, and application data." alt="" coords="64,159,179,188"/> <area shape="rect" id="node3" href="wx.EvtHandler.html" title="A class that can handle events from the windowing system." alt="" coords="55,82,188,111"/> <area shape="rect" id="node4" href="wx.Object.html" title="This is the root class of many of the wxWidgets classes." alt="" coords="5,5,104,34"/> <area shape="rect" id="node5" href="wx.Trackable.html" title="Add-on base class for a trackable object." alt="" coords="128,5,251,34"/> </map> 
   </p>
   </div>

|


|super_classes| Known Superclasses
==================================

:class:`wx.Validator`

|


|method_summary| Methods Summary
================================

================================================================================ ================================================================================
:meth:`~wx.lib.intctrl.IntValidator.__init__`                                    Standard constructor
:meth:`~wx.lib.intctrl.IntValidator.Clone`                                       Standard cloner
:meth:`~wx.lib.intctrl.IntValidator.OnChar`                                      Validates keystrokes to make sure the resulting value will a legal
:meth:`~wx.lib.intctrl.IntValidator.TransferFromWindow`                          Transfer data from window to validator.
:meth:`~wx.lib.intctrl.IntValidator.TransferToWindow`                            Transfer data from validator to window.
:meth:`~wx.lib.intctrl.IntValidator.Validate`                                    Because each operation on the control is vetted as it's made,
================================================================================ ================================================================================


|


|api| Class API
===============


.. class:: IntValidator(wx.Validator)

   Validator class used with :class:`~lib.intctrl.IntCtrl` handles all validation of
   input prior to changing the value of the underlying :class:`TextCtrl`.

   .. method:: __init__(self)

      Standard constructor


   .. method:: Clone (self)

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


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


   .. method:: 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. :class:`Dialog`
      that all is well.
      
      If data comes e.g. from a database then you need to override this.


   .. method:: 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. :class:`Dialog`
      that all is well.
      
      If data comes e.g. from a database then you need to override this.


   .. method:: Validate(self, window)

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