.. include:: headings.inc .. currentmodule:: lib.masked.textctrl .. highlight:: python .. _lib.masked.textctrl.BaseMaskedTextCtrl: ========================================================================================================================================== |phoenix_title| **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| Inheritance Diagram ===================================== Inheritance diagram for class **BaseMaskedTextCtrl** .. raw:: html

Inheritance diagram of BaseMaskedTextCtrl

| |sub_classes| Known Subclasses ============================== :class:`lib.masked.textctrl.PreMaskedTextCtrl`, :class:`lib.masked.textctrl.TextCtrl` | |super_classes| Known Superclasses ================================== :class:`TextCtrl`, :class:`lib.masked.maskededit.MaskedEditMixin` | |method_summary| Methods Summary ================================ ================================================================================ ================================================================================ :meth:`~lib.masked.textctrl.BaseMaskedTextCtrl.__init__` :meth:`~lib.masked.textctrl.BaseMaskedTextCtrl.ChangeValue` Provided to accomodate similar functionality added to base control in wxPython 2.7.1.1. :meth:`~lib.masked.textctrl.BaseMaskedTextCtrl.Clear` Blanks the current control value by replacing it with the default value. :meth:`~lib.masked.textctrl.BaseMaskedTextCtrl.Cut` This function redefines the externally accessible .Cut to be :meth:`~lib.masked.textctrl.BaseMaskedTextCtrl.IsEmpty` :meth:`~lib.masked.textctrl.BaseMaskedTextCtrl.IsModified` This function overrides the raw wx.TextCtrl method, because the :meth:`~lib.masked.textctrl.BaseMaskedTextCtrl.ModifyValue` This factored function of common code does the bulk of the work for SetValue :meth:`~lib.masked.textctrl.BaseMaskedTextCtrl.Paste` This function redefines the externally accessible .Paste to be :meth:`~lib.masked.textctrl.BaseMaskedTextCtrl.Refresh` This function redefines the externally accessible .Refresh() to :meth:`~lib.masked.textctrl.BaseMaskedTextCtrl.SetFont` Set the font, then recalculate control size, if appropriate. :meth:`~lib.masked.textctrl.BaseMaskedTextCtrl.SetValue` This function redefines the externally accessible .SetValue() to be :meth:`~lib.masked.textctrl.BaseMaskedTextCtrl.Undo` This function defines the undo operation for the control. (The default ================================================================================ ================================================================================ | |api| Class API =============== .. class:: BaseMaskedTextCtrl( 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 = DefaultPosition, size = DefaultSize, style = TE_PROCESS_TAB, validator=DefaultValidator, name = 'maskedTextCtrl', setupEventHandling = True, \*\*kwargs) .. method:: ChangeValue(self, value) Provided to accomodate similar functionality added to base control in wxPython 2.7.1.1. .. method:: Clear(self) Blanks the current control value by replacing it with the default value. .. method:: Cut(self) This function redefines the externally accessible .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 wx.TextCtrl 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. .. method:: Paste(self) This function redefines the externally accessible .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 .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. .. method:: SetValue(self, value) This function redefines the externally accessible .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.)