From: Robin Dunn Date: Mon, 30 May 2005 18:48:23 +0000 (+0000) Subject: Allow wxGridCellNumberEditor::StartingKey to work when the control is X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/eb5e42b615add3f803a2ce82acdae4bab5942f14 Allow wxGridCellNumberEditor::StartingKey to work when the control is a spinctrl too. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34422 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index a658bb4db2..55049525f7 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -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(); }