]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/wx/lib/masked/numctrl.py
non-pch build fix
[wxWidgets.git] / wxPython / wx / lib / masked / numctrl.py
index e48eacd7b7a5b07984fbe9103edd215e7750ec63..1256ee078095baba0a2016dbb6e80d46ab4ebbdd 100644 (file)
@@ -762,12 +762,6 @@ class NumCtrl(BaseMaskedTextCtrl, NumCtrlAccessorsMixin):
         if maskededit_kwargs.keys():
             self.SetCtrlParameters(**maskededit_kwargs)
 
-        # Record end of integer and place cursor there:
-        integerEnd = self._fields[0]._extent[1]
-        self.SetInsertionPoint(0)
-        self.SetInsertionPoint(integerEnd)
-        self.SetSelection(integerEnd, integerEnd)
-
         # Go ensure all the format codes necessary are present:
         orig_intformat = intformat = self.GetFieldParameter(0, 'formatcodes')
         if 'r' not in intformat:
@@ -780,6 +774,17 @@ class NumCtrl(BaseMaskedTextCtrl, NumCtrlAccessorsMixin):
             else:
                 self.SetCtrlParameters(formatcodes=intformat)
 
+        # Record end of integer and place cursor there unless selecting, or select entire field:
+        integerStart, integerEnd = self._fields[0]._extent
+        if not self._fields[0]._selectOnFieldEntry:
+            self.SetInsertionPoint(0)
+            self.SetInsertionPoint(integerEnd)
+            self.SetSelection(integerEnd, integerEnd)
+        else:
+            self.SetInsertionPoint(0)   # include any sign
+            self.SetSelection(0, integerEnd)
+
+
         # Set min and max as appropriate:
         if kwargs.has_key('min'):
             min = kwargs['min']