X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5648c0ad511627e710807752ec6d193f11b8c23e..1b489359c4051c23262e3118b4489054ef7f3843:/src/msw/spinctrl.cpp diff --git a/src/msw/spinctrl.cpp b/src/msw/spinctrl.cpp index 22ee0816c9..6057edf837 100644 --- a/src/msw/spinctrl.cpp +++ b/src/msw/spinctrl.cpp @@ -85,9 +85,12 @@ LRESULT APIENTRY _EXPORT wxBuddyTextWndProc(HWND hwnd, { wxSpinCtrl *spin = (wxSpinCtrl *)::GetWindowLong(hwnd, GWL_USERDATA); - // forward some messages (the key ones only so far) to the spin ctrl + // forward some messages (the key and focus ones only so far) to + // the spin ctrl switch ( message ) { + case WM_SETFOCUS: + case WM_KILLFOCUS: case WM_CHAR: case WM_DEADCHAR: case WM_KEYUP: @@ -349,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 // ----------------------------------------------------------------------------