From: Gilles Depeyrot Date: Sun, 1 Sep 2002 21:29:40 +0000 (+0000) Subject: added wxSpinCtrl::SetSelection method X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/a811affe70feeb727bf7fbd2748a48ded6ec3b9b added wxSpinCtrl::SetSelection method git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16923 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/mac/spinctrl.h b/include/wx/mac/spinctrl.h index 76f0dc3412..746dac82c4 100755 --- a/include/wx/mac/spinctrl.h +++ b/include/wx/mac/spinctrl.h @@ -60,6 +60,9 @@ public: int min = 0, int max = 100, int initial = 0, const wxString& name = _T("wxSpinCtrl")); + // wxTextCtrl-like method + void SetSelection(long from, long to); + virtual ~wxSpinCtrl(); // operations diff --git a/src/mac/carbon/spinctrl.cpp b/src/mac/carbon/spinctrl.cpp index a083c8a3c5..22553d47f1 100644 --- a/src/mac/carbon/spinctrl.cpp +++ b/src/mac/carbon/spinctrl.cpp @@ -319,4 +319,15 @@ void wxSpinCtrl::SetRange(int min, int max) m_btn->SetRange(min, max); } +void wxSpinCtrl::SetSelection(long from, long to) +{ + // if from and to are both -1, it means (in wxWindows) that all text should + // be selected + if ( (from == -1) && (to == -1) ) + { + from = 0; + } + m_text->SetSelection(from, to); +} + #endif // wxUSE_SPINCTRL diff --git a/src/mac/spinctrl.cpp b/src/mac/spinctrl.cpp index a083c8a3c5..22553d47f1 100644 --- a/src/mac/spinctrl.cpp +++ b/src/mac/spinctrl.cpp @@ -319,4 +319,15 @@ void wxSpinCtrl::SetRange(int min, int max) m_btn->SetRange(min, max); } +void wxSpinCtrl::SetSelection(long from, long to) +{ + // if from and to are both -1, it means (in wxWindows) that all text should + // be selected + if ( (from == -1) && (to == -1) ) + { + from = 0; + } + m_text->SetSelection(from, to); +} + #endif // wxUSE_SPINCTRL