From: Vadim Zeitlin Date: Fri, 30 Aug 2002 01:00:04 +0000 (+0000) Subject: added wxSpinCtrl::SetSelection() X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/07901ec945462644af6efef53a5d600813a0b038 added wxSpinCtrl::SetSelection() git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16860 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/msw/spinctrl.h b/include/wx/msw/spinctrl.h index 79c5c74a2c..70dc78a208 100644 --- a/include/wx/msw/spinctrl.h +++ b/include/wx/msw/spinctrl.h @@ -59,6 +59,9 @@ public: // because the base class already has one returning int!) void SetValue(const wxString& text); + // another wxTextCtrl-like method + void SetSelection(long from, long to); + // implementation only from now on // ------------------------------- diff --git a/src/msw/spinctrl.cpp b/src/msw/spinctrl.cpp index dbf5cdceef..6057edf837 100644 --- a/src/msw/spinctrl.cpp +++ b/src/msw/spinctrl.cpp @@ -352,6 +352,18 @@ int wxSpinCtrl::GetValue() const return n; } +void wxSpinCtrl::SetSelection(long from, long to) +{ + // if from and to are both -1, it means (in wxWindows) that all text should + // be selected - translate into Windows convention + if ( (from == -1) && (to == -1) ) + { + from = 0; + } + + ::SendMessage((HWND)m_hwndBuddy, EM_SETSEL, (WPARAM)from, (LPARAM)to); +} + // ---------------------------------------------------------------------------- // forward some methods to subcontrols // ----------------------------------------------------------------------------