]> git.saurik.com Git - wxWidgets.git/commitdiff
honour wxSP_ARROW_KEYS in wxSpinCtrlGeneric and don't handle the arrows unless it...
authorVadim Zeitlin <vadim@wxwidgets.org>
Tue, 10 Mar 2009 15:36:17 +0000 (15:36 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Tue, 10 Mar 2009 15:36:17 +0000 (15:36 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59472 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

samples/widgets/spinbtn.cpp
src/generic/spinctlg.cpp

index 8f8980664604a48807d449fb3a3a001d09aa85d0..bf396d7cb7e88c1542dd5f99e1fd094607a5c1cc 100644 (file)
@@ -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;
 
index 70a58db5352f69f40ebe57780818c12bbe1f96d8..21e2d60d974c5daf4bdb19e916a8243469c094ff 100644 (file)
@@ -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() )
     {