1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254
|
.. wxPython Phoenix documentation
This file was generated by Phoenix's sphinx generator and associated
tools, do not edit by hand.
Copyright: (c) 2011-2018 by Total Control Software
License: wxWindows License
.. include:: headings.inc
.. currentmodule:: wx.lib.masked.textctrl
.. highlight:: python
.. _wx.lib.masked.textctrl.BaseMaskedTextCtrl:
==========================================================================================================================================
|phoenix_title| **wx.lib.masked.textctrl.BaseMaskedTextCtrl**
==========================================================================================================================================
This is the primary derivation from MaskedEditMixin. It provides
a general masked text control that can be configured with different
masks.
However, this is done with an extra level of inheritance, so that
"general" classes like masked.TextCtrl can have all possible attributes,
while derived classes, like masked.TimeCtrl and masked.NumCtrl
can prevent exposure of those optional attributes of their base
class that do not make sense for their derivation. Therefore,
we define::
BaseMaskedTextCtrl(TextCtrl, MaskedEditMixin)
and::
masked.TextCtrl(BaseMaskedTextCtrl, MaskedEditAccessorsMixin).
This allows us to then derive::
masked.NumCtrl( BaseMaskedTextCtrl )
and not have to expose all the same accessor functions for the
derived control when they don't all make sense for it.
In practice, BaseMaskedTextCtrl should never be instantiated directly,
but should only be used in derived classes.
|
|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>BaseMaskedTextCtrl</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.masked.textctrl.BaseMaskedTextCtrl_inheritance.png" alt="Inheritance diagram of BaseMaskedTextCtrl" usemap="#dummy" class="inheritance"/></center>
</div>
<script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
<map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.TextCtrl.html" title="wx.TextCtrl" alt="" coords="327,392,416,421"/> <area shape="rect" id="node9" href="wx.lib.masked.textctrl.BaseMaskedTextCtrl.html" title="wx.lib.masked.textctrl.BaseMaskedTextCtrl" alt="" coords="117,469,408,499"/> <area shape="rect" id="node2" href="wx.Control.html" title="wx.Control" alt="" coords="268,315,356,344"/> <area shape="rect" id="node3" href="wx.TextEntry.html" title="wx.TextEntry" alt="" coords="381,315,480,344"/> <area shape="rect" id="node4" href="wx.Trackable.html" title="wx.Trackable" alt="" coords="204,5,305,35"/> <area shape="rect" id="node5" href="wx.EvtHandler.html" title="wx.EvtHandler" alt="" coords="256,83,367,112"/> <area shape="rect" id="node8" href="wx.WindowBase.html" title="wx.WindowBase" alt="" coords="251,160,372,189"/> <area shape="rect" id="node6" href="wx.Object.html" title="wx.Object" alt="" coords="329,5,411,35"/> <area shape="rect" id="node7" href="wx.lib.masked.maskededit.MaskedEditMixin.html" title="wx.lib.masked.maskededit.MaskedEditMixin" alt="" coords="4,392,301,421"/> <area shape="rect" id="node10" href="wx.Window.html" title="wx.Window" alt="" coords="267,237,356,267"/> </map>
</p>
|
|sub_classes| Known Subclasses
==============================
:class:`wx.lib.masked.ipaddrctrl.IpAddrCtrl`, :class:`wx.lib.masked.numctrl.NumCtrl`, :class:`wx.lib.masked.textctrl.PreMaskedTextCtrl`, :class:`wx.lib.masked.textctrl.TextCtrl`, :class:`wx.lib.masked.timectrl.TimeCtrl`
|
|super_classes| Known Superclasses
==================================
:class:`wx.TextCtrl`, :class:`wx.lib.masked.maskededit.MaskedEditMixin`
|
|method_summary| Methods Summary
================================
================================================================================ ================================================================================
:meth:`~wx.lib.masked.textctrl.BaseMaskedTextCtrl.__init__` Default class constructor.
:meth:`~wx.lib.masked.textctrl.BaseMaskedTextCtrl.ChangeValue` Provided to accomodate similar functionality added to base
:meth:`~wx.lib.masked.textctrl.BaseMaskedTextCtrl.Clear` Blanks the current control value by replacing it with the default value.
:meth:`~wx.lib.masked.textctrl.BaseMaskedTextCtrl.Cut` This function redefines the externally accessible :meth:`TextCtrl.Cut`
:meth:`~wx.lib.masked.textctrl.BaseMaskedTextCtrl.IsEmpty`
:meth:`~wx.lib.masked.textctrl.BaseMaskedTextCtrl.IsModified` This function overrides the raw :meth:`TextCtrl.IsModified` method,
:meth:`~wx.lib.masked.textctrl.BaseMaskedTextCtrl.ModifyValue` This factored function of common code does the bulk of the work for
:meth:`~wx.lib.masked.textctrl.BaseMaskedTextCtrl.Paste` This function redefines the externally accessible :meth:`TextCtrl.Paste`
:meth:`~wx.lib.masked.textctrl.BaseMaskedTextCtrl.Refresh` This function redefines the externally accessible :meth:`TextCtrl.Refresh`
:meth:`~wx.lib.masked.textctrl.BaseMaskedTextCtrl.SetFont` Set the font, then recalculate control size, if appropriate.
:meth:`~wx.lib.masked.textctrl.BaseMaskedTextCtrl.SetValue` This function redefines the externally accessible :meth:`TextCtrl.SetValue`
:meth:`~wx.lib.masked.textctrl.BaseMaskedTextCtrl.Undo` This function defines the undo operation for the control.
================================================================================ ================================================================================
|
|api| Class API
===============
.. class:: BaseMaskedTextCtrl( wx.TextCtrl, MaskedEditMixin )
This is the primary derivation from MaskedEditMixin. It provides
a general masked text control that can be configured with different
masks.
However, this is done with an extra level of inheritance, so that
"general" classes like masked.TextCtrl can have all possible attributes,
while derived classes, like masked.TimeCtrl and masked.NumCtrl
can prevent exposure of those optional attributes of their base
class that do not make sense for their derivation. Therefore,
we define::
BaseMaskedTextCtrl(TextCtrl, MaskedEditMixin)
and::
masked.TextCtrl(BaseMaskedTextCtrl, MaskedEditAccessorsMixin).
This allows us to then derive::
masked.NumCtrl( BaseMaskedTextCtrl )
and not have to expose all the same accessor functions for the
derived control when they don't all make sense for it.
In practice, BaseMaskedTextCtrl should never be instantiated directly,
but should only be used in derived classes.
.. method:: __init__( self, parent, id=-1, value = '', pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.TE_PROCESS_TAB, validator=wx.DefaultValidator, name = 'maskedTextCtrl', setupEventHandling = True, \*\*kwargs)
Default class constructor.
:param wx.Window `parent`: the window parent. Must not be ``None``;
:param integer `id`: window identifier. A value of -1 indicates a default value;
:param string `value`: value to be shown;
:param `pos`: the control position. A value of (-1, -1) indicates a default position,
chosen by either the windowing system or wxPython, depending on platform;
:type `pos`: tuple or :class:`wx.Point`
:param `size`: the control size. A value of (-1, -1) indicates a default size,
chosen by either the windowing system or wxPython, depending on platform;
:param integer `style`: the window style;
:param wx.Validator `validator`: this is mainly provided for data-transfer, as control does
its own validation;
:param string `name`: the window name;
:param boolean `setupEventHandling`: setup event handling by default.
.. method:: ChangeValue(self, value)
Provided to accomodate similar functionality added to base
control in wxPython 2.7.1.1.
:param string `value`: new value for control, this will not fire an event
.. method:: Clear(self)
Blanks the current control value by replacing it with the default value.
.. method:: Cut(self)
This function redefines the externally accessible :meth:`TextCtrl.Cut`
to be a smart "erase" of the text in question, so as not to corrupt the
masked control.
.. note::
This must be done in the class derived from the base wx control.
.. method:: IsEmpty(\*args, \*\*kw)
.. method:: IsModified(self)
This function overrides the raw :meth:`TextCtrl.IsModified` method,
because the masked edit mixin uses SetValue to change the value, which
doesn't modify the state of this attribute. So, the derived control
keeps track on each keystroke to see if the value changes, and if so,
it's been modified.
.. method:: ModifyValue(self, value, use_change_value=False)
This factored function of common code does the bulk of the work for
SetValue and ChangeValue.
:param string `value`: new value for control
:param boolean `use_change_value`: if ``True`` uses :meth:`~lib.masked.textctrl.TextCtrl.ChangeValue`
.. method:: Paste(self)
This function redefines the externally accessible :meth:`TextCtrl.Paste`
to be a smart "paste" of the text in question, so as not to corrupt the
masked control.
.. note::
This must be done in the class derived from the base wx control.
.. method:: Refresh(self)
This function redefines the externally accessible :meth:`TextCtrl.Refresh`
to validate the contents of the masked control as it refreshes.
.. note::
This must be done in the class derived from the base wx control.
.. method:: SetFont(self, \*args, \*\*kwargs)
Set the font, then recalculate control size, if appropriate.
see :meth:`TextCtrl.SetFont` for valid arguements
.. method:: SetValue(self, value)
This function redefines the externally accessible :meth:`TextCtrl.SetValue`
to be a smart "paste" of the text in question, so as not to corrupt the
masked control.
.. note::
This must be done in the class derived from the base wx control.
.. method:: Undo(self)
This function defines the undo operation for the control.
(The default undo is 1-deep.)
|