]> git.saurik.com Git - wxWidgets.git/commitdiff
Allow wxGridCellNumberEditor::StartingKey to work when the control is
authorRobin Dunn <robin@alldunn.com>
Mon, 30 May 2005 18:48:23 +0000 (18:48 +0000)
committerRobin Dunn <robin@alldunn.com>
Mon, 30 May 2005 18:48:23 +0000 (18:48 +0000)
a spinctrl too.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34422 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/generic/grid.cpp

index a658bb4db2b4235e393c5f3adca92aa947aa4b98..55049525f78ed0584fedcf9c2227e4fdb0699066 100644 (file)
@@ -956,9 +956,9 @@ bool wxGridCellNumberEditor::IsAcceptedKey(wxKeyEvent& event)
 
 void wxGridCellNumberEditor::StartingKey(wxKeyEvent& event)
 {
+    int keycode = event.GetKeyCode();
     if ( !HasRange() )
     {
-        int keycode = event.GetKeyCode();
         if ( wxIsdigit(keycode) || keycode == '+' || keycode == '-')
         {
             wxGridCellTextEditor::StartingKey(event);
@@ -967,7 +967,18 @@ void wxGridCellNumberEditor::StartingKey(wxKeyEvent& event)
             return;
         }
     }
-
+#if wxUSE_SPINCTRL
+    else
+    {
+        if ( wxIsdigit(keycode) )
+        {
+            wxSpinCtrl* spin = (wxSpinCtrl*)m_control;
+            spin->SetValue(keycode - '0');
+            spin->SetSelection(1,1);
+            return;
+        }
+    }
+#endif
     event.Skip();
 }