Updates to MaskedEdit controls from Will Sadkin:
maskededit.py: Added parameter option stopFieldChangeIfInvalid, which can be used to relax the validation rules for a control, but make best efforts to stop navigation out of that field should its current value be invalid. Note: this does not prevent the value from remaining invalid if focus for the control is lost, via mousing etc. numctrl.py, demo / MaskedNumCtrl.py: In response to user request, added limitOnFieldChange feature, so that out-of-bounds values can be temporarily added to the control, but should navigation be attempted out of an invalid field, it will not navigate, and if focus is lost on a control so limited with an invalid value, it will change the value to the nearest bound. combobox.py: Added handler for EVT_COMBOBOX to address apparently inconsistent behavior of control when the dropdown control is used to do a selection. textctrl.py Added support for ChangeValue() function, similar to that of the base control, added in wxPython 2.7.1.1. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@45743 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -162,6 +162,8 @@ class BaseMaskedComboBox( wx.ComboBox, MaskedEditMixin ):
|
||||
self.Bind(wx.EVT_KEY_DOWN, self._OnKeyDownInComboBox ) ## for special processing of up/down keys
|
||||
self.Bind(wx.EVT_KEY_DOWN, self._OnKeyDown ) ## for processing the rest of the control keys
|
||||
## (next in evt chain)
|
||||
self.Bind(wx.EVT_COMBOBOX, self._OnDropdownSelect) ## to bring otherwise completely independent base
|
||||
## ctrl selection into maskededit framework
|
||||
self.Bind(wx.EVT_TEXT, self._OnTextChange ) ## color control appropriately & keep
|
||||
## track of previous value for undo
|
||||
|
||||
@@ -531,6 +533,18 @@ class BaseMaskedComboBox( wx.ComboBox, MaskedEditMixin ):
|
||||
event.Skip() # let mixin default KeyDown behavior occur
|
||||
|
||||
|
||||
def _OnDropdownSelect(self, event):
|
||||
"""
|
||||
This function appears to be necessary because dropdown selection seems to
|
||||
manipulate the contents of the control in an inconsistent way, properly
|
||||
changing the selection index, but *not* the value. (!) Calling SetSelection()
|
||||
on a selection event for the same selection would seem like a nop, but it seems to
|
||||
fix the problem.
|
||||
"""
|
||||
self.SetSelection(event.GetSelection())
|
||||
event.Skip()
|
||||
|
||||
|
||||
def _OnSelectChoice(self, event):
|
||||
"""
|
||||
This function appears to be necessary, because the processing done
|
||||
@@ -659,6 +673,10 @@ class PreMaskedComboBox( BaseMaskedComboBox, MaskedEditAccessorsMixin ):
|
||||
__i = 0
|
||||
## CHANGELOG:
|
||||
## ====================
|
||||
## Version 1.4
|
||||
## 1. Added handler for EVT_COMBOBOX to address apparently inconsistent behavior
|
||||
## of control when the dropdown control is used to do a selection.
|
||||
##
|
||||
## Version 1.3
|
||||
## 1. Made definition of "hack" GetMark conditional on base class not
|
||||
## implementing it properly, to allow for migration in wx code base
|
||||
|
Reference in New Issue
Block a user