Applied patch from Will Sadkin
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@19143 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -295,10 +295,12 @@ class wxIntValidator( wxPyValidator ):
|
|||||||
elif set_to_zero:
|
elif set_to_zero:
|
||||||
# select to "empty" numeric value
|
# select to "empty" numeric value
|
||||||
wxCallAfter(ctrl.SetValue, new_value)
|
wxCallAfter(ctrl.SetValue, new_value)
|
||||||
|
wxCallAfter(ctrl.SetInsertionPoint, 0)
|
||||||
wxCallAfter(ctrl.SetSelection, 0, 1)
|
wxCallAfter(ctrl.SetSelection, 0, 1)
|
||||||
|
|
||||||
elif set_to_minus_one:
|
elif set_to_minus_one:
|
||||||
wxCallAfter(ctrl.SetValue, new_value)
|
wxCallAfter(ctrl.SetValue, new_value)
|
||||||
|
wxCallAfter(ctrl.SetInsertionPoint, 1)
|
||||||
wxCallAfter(ctrl.SetSelection, 1, 2)
|
wxCallAfter(ctrl.SetSelection, 1, 2)
|
||||||
|
|
||||||
elif not internally_set:
|
elif not internally_set:
|
||||||
@@ -747,6 +749,7 @@ class wxIntCtrl(wxTextCtrl):
|
|||||||
if select_len == len(wxTextCtrl.GetValue(self)):
|
if select_len == len(wxTextCtrl.GetValue(self)):
|
||||||
if not self.IsNoneAllowed():
|
if not self.IsNoneAllowed():
|
||||||
self.SetValue(0)
|
self.SetValue(0)
|
||||||
|
self.SetInsertionPoint(0)
|
||||||
self.SetSelection(0,1)
|
self.SetSelection(0,1)
|
||||||
else:
|
else:
|
||||||
self.SetValue(None)
|
self.SetValue(None)
|
||||||
@@ -842,6 +845,7 @@ if __name__ == '__main__':
|
|||||||
def OnClick(self, event):
|
def OnClick(self, event):
|
||||||
dlg = myDialog(self.panel, -1, "test wxIntCtrl")
|
dlg = myDialog(self.panel, -1, "test wxIntCtrl")
|
||||||
dlg.int_ctrl.SetValue(501)
|
dlg.int_ctrl.SetValue(501)
|
||||||
|
dlg.int_ctrl.SetInsertionPoint(1)
|
||||||
dlg.int_ctrl.SetSelection(1,2)
|
dlg.int_ctrl.SetSelection(1,2)
|
||||||
rc = dlg.ShowModal()
|
rc = dlg.ShowModal()
|
||||||
print 'final value', dlg.int_ctrl.GetValue()
|
print 'final value', dlg.int_ctrl.GetValue()
|
||||||
|
Reference in New Issue
Block a user