From fd07e185b46d550b70864a1ad0e40544630d49f1 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 10 Mar 2009 15:36:17 +0000 Subject: [PATCH] honour wxSP_ARROW_KEYS in wxSpinCtrlGeneric and don't handle the arrows unless it's specified (closes #10565) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59472 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- samples/widgets/spinbtn.cpp | 7 +++++++ src/generic/spinctlg.cpp | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/samples/widgets/spinbtn.cpp b/samples/widgets/spinbtn.cpp index 8f89806646..bf396d7cb7 100644 --- a/samples/widgets/spinbtn.cpp +++ b/samples/widgets/spinbtn.cpp @@ -127,6 +127,7 @@ protected: // the check/radio boxes for styles wxCheckBox *m_chkVert, + *m_chkArrowKeys, *m_chkWrap, *m_chkProcessEnter; @@ -195,6 +196,7 @@ SpinBtnWidgetsPage::SpinBtnWidgetsPage(WidgetsBookCtrl *book, : WidgetsPage(book, imaglist, spinbtn_xpm) { m_chkVert = NULL; + m_chkArrowKeys = NULL; m_chkWrap = NULL; m_chkProcessEnter = NULL; m_spinbtn = NULL; @@ -219,6 +221,7 @@ void SpinBtnWidgetsPage::CreateContent() wxSizer *sizerLeft = new wxStaticBoxSizer(box, wxVERTICAL); m_chkVert = CreateCheckBoxAndAddToSizer(sizerLeft, _T("&Vertical")); + m_chkArrowKeys = CreateCheckBoxAndAddToSizer(sizerLeft, _T("&Arrow Keys")); m_chkWrap = CreateCheckBoxAndAddToSizer(sizerLeft, _T("&Wrap")); m_chkProcessEnter = CreateCheckBoxAndAddToSizer(sizerLeft, _T("Process &Enter")); @@ -285,6 +288,7 @@ void SpinBtnWidgetsPage::CreateContent() void SpinBtnWidgetsPage::Reset() { m_chkVert->SetValue(true); + m_chkArrowKeys->SetValue(true); m_chkWrap->SetValue(false); m_chkProcessEnter->SetValue(false); } @@ -299,6 +303,9 @@ void SpinBtnWidgetsPage::CreateSpin() else flags |= wxSP_HORIZONTAL; + if ( m_chkArrowKeys->GetValue() ) + flags |= wxSP_ARROW_KEYS; + if ( m_chkWrap->GetValue() ) flags |= wxSP_WRAP; diff --git a/src/generic/spinctlg.cpp b/src/generic/spinctlg.cpp index 70a58db535..21e2d60d97 100644 --- a/src/generic/spinctlg.cpp +++ b/src/generic/spinctlg.cpp @@ -369,6 +369,12 @@ void wxSpinCtrlGenericBase::OnTextEnter(wxCommandEvent& event) void wxSpinCtrlGenericBase::OnTextChar(wxKeyEvent& event) { + if ( !HasFlag(wxSP_ARROW_KEYS) ) + { + event.Skip(); + return; + } + double value = m_value; switch ( event.GetKeyCode() ) { -- 2.45.2