]> git.saurik.com Git - wxWidgets.git/commitdiff
added wxSpinCtrl::SetSelection()
authorVadim Zeitlin <vadim@wxwidgets.org>
Fri, 30 Aug 2002 01:00:04 +0000 (01:00 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Fri, 30 Aug 2002 01:00:04 +0000 (01:00 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16860 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/msw/spinctrl.h
src/msw/spinctrl.cpp

index 79c5c74a2c6bb1093570dff4b0c0f9dc06f1a3db..70dc78a2080d04995b1e7f49c8aa3f4ba8821a23 100644 (file)
@@ -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
     // -------------------------------
 
index dbf5cdceef1a3bd91550f85a00294f72ad7b16e3..6057edf8377e3c53f203333e32fd10694d15c484 100644 (file)
@@ -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
 // ----------------------------------------------------------------------------