From: Vadim Zeitlin Date: Sat, 31 Aug 2002 22:52:24 +0000 (+0000) Subject: SetSelection() for generic wxSpinCtrl (forgot to commit before) X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/739555e3218220043efa230cca8e44a91ae82d30 SetSelection() for generic wxSpinCtrl (forgot to commit before) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16898 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/generic/spinctlg.h b/include/wx/generic/spinctlg.h index 1175f102d0..d6d9a4043b 100644 --- a/include/wx/generic/spinctlg.h +++ b/include/wx/generic/spinctlg.h @@ -20,7 +20,7 @@ // without tons of #ifdefs. // ---------------------------------------------------------------------------- -#if wxUSE_SPINBTN +#if wxUSE_SPINBTN #if defined(__GNUG__) && !defined(__APPLE__) #pragma interface "spinctlg.h" @@ -66,6 +66,7 @@ public: void SetValue(int val); void SetValue(const wxString& text); void SetRange(int min, int max); + void SetSelection(long from, long to); // accessors int GetValue() const; @@ -102,7 +103,7 @@ private: // the subcontrols wxTextCtrl *m_text; wxSpinButton *m_btn; - + private: DECLARE_DYNAMIC_CLASS(wxSpinCtrl) }; diff --git a/src/generic/spinctlg.cpp b/src/generic/spinctlg.cpp index 548025594a..eb52e041a2 100644 --- a/src/generic/spinctlg.cpp +++ b/src/generic/spinctlg.cpp @@ -134,7 +134,7 @@ BEGIN_EVENT_TABLE(wxSpinCtrlButton, wxSpinButton) END_EVENT_TABLE() IMPLEMENT_DYNAMIC_CLASS(wxSpinCtrl, wxControl) - + // ============================================================================ // implementation // ============================================================================ @@ -366,5 +366,12 @@ void wxSpinCtrl::SetRange(int min, int max) m_btn->SetRange(min, max); } +void wxSpinCtrl::SetSelection(long from, long to) +{ + wxCHECK_RET( m_text, _T("invalid call to wxSpinCtrl::SetSelection") ); + + m_text->SetSelection(from, to); +} + #endif // wxUSE_SPINCTRL #endif // !wxPort-with-native-spinctrl