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.
wx.lib.masked.ipaddrctrl.IpAddrCtrl
, wx.lib.masked.numctrl.NumCtrl
, wx.lib.masked.textctrl.PreMaskedTextCtrl
, wx.lib.masked.textctrl.TextCtrl
, wx.lib.masked.timectrl.TimeCtrl
wx.TextCtrl
, wx.lib.masked.maskededit.MaskedEditMixin
Default class constructor. |
|
Provided to accommodate similar functionality added to base |
|
Blanks the current control value by replacing it with the default value. |
|
This function redefines the externally accessible |
|
IsEmpty() -> bool |
|
This function overrides the raw |
|
This factored function of common code does the bulk of the work for |
|
This function redefines the externally accessible |
|
This function redefines the externally accessible |
|
Set the font, then recalculate control size, if appropriate. |
|
This function redefines the externally accessible |
|
This function defines the undo operation for the control. |
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.
__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.
parent (wx.Window) – the window parent. Must not be None
;
id (integer) – window identifier. A value of -1 indicates a default value;
value (string) – value to be shown;
pos (tuple or wx.Point
) – the control position. A value of (-1, -1) indicates a default position,
chosen by either the windowing system or wxPython, depending on platform;
size – the control size. A value of (-1, -1) indicates a default size, chosen by either the windowing system or wxPython, depending on platform;
style (integer) – the window style;
validator (wx.Validator) – this is mainly provided for data-transfer, as control does its own validation;
name (string) – the window name;
setupEventHandling (boolean) – setup event handling by default.
ChangeValue
(self, value)¶Provided to accommodate similar functionality added to base control in wxPython 2.7.1.1.
value (string) – new value for control, this will not fire an event
Clear
(self)¶Blanks the current control value by replacing it with the default value.
Cut
(self)¶This function redefines the externally accessible 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.
IsEmpty
(*args, **kw)¶IsEmpty() -> bool
Returns true if the control is currently empty.
IsModified
(self)¶This function overrides the raw 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.
ModifyValue
(self, value, use_change_value=False)¶This factored function of common code does the bulk of the work for SetValue and ChangeValue.
value (string) – new value for control
use_change_value (boolean) – if True
uses ChangeValue
Paste
(self)¶This function redefines the externally accessible 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.
Refresh
(self)¶This function redefines the externally accessible 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.
SetFont
(self, *args, **kwargs)¶Set the font, then recalculate control size, if appropriate.
see TextCtrl.SetFont
for valid arguments
SetValue
(self, value)¶This function redefines the externally accessible 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.
Undo
(self)¶This function defines the undo operation for the control. (The default undo is 1-deep.)