X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a12546634d8d190b4b1503c5d6533971b26e5862..2fb18bf45bcf391a8eb973886072dc67893e9bbe:/src/msw/combobox.cpp?ds=sidebyside diff --git a/src/msw/combobox.cpp b/src/msw/combobox.cpp index c15da2ee31..50681b9440 100644 --- a/src/msw/combobox.cpp +++ b/src/msw/combobox.cpp @@ -17,10 +17,6 @@ // headers // ---------------------------------------------------------------------------- -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) -#pragma implementation "combobox.h" -#endif - // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" @@ -259,6 +255,9 @@ WXLRESULT wxComboBox::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lPara break; case WM_SIZE: + // wxStaticBox can generate this message, when modifying the control's style. + // This causes the content of the combobox to be selected, for some reason. + case WM_STYLECHANGED: { // combobox selection sometimes spontaneously changes when its // size changes, restore it to the old value if necessary @@ -325,7 +324,7 @@ bool wxComboBox::MSWProcessEditMsg(WXUINT msg, WXWPARAM wParam, WXLPARAM lParam) return false; } -bool wxComboBox::MSWCommand(WXUINT param, WXWORD WXUNUSED(id)) +bool wxComboBox::MSWCommand(WXUINT param, WXWORD id) { wxString value; int sel = -1; @@ -395,10 +394,14 @@ bool wxComboBox::MSWCommand(WXUINT param, WXWORD WXUNUSED(id)) ProcessCommand(event); } break; + + default: + return wxChoice::MSWCommand(param, id); } - // there is no return value for the CBN_ notifications, so always return - // false from here to pass the message to DefWindowProc() + // let the def window proc have it by returning false, but do not pass the + // message we've already handled here (notably CBN_SELCHANGE) to the base + // class as it would generate another event for them return false; } @@ -571,7 +574,7 @@ bool wxComboBox::CanUndo() const { if (!IsEditable()) return false; - + HWND hEditWnd = (HWND) GetEditHWND() ; if ( hEditWnd ) return ::SendMessage(hEditWnd, EM_CANUNDO, 0, 0) != 0; @@ -583,7 +586,7 @@ bool wxComboBox::CanRedo() const { if (!IsEditable()) return false; - + HWND hEditWnd = (HWND) GetEditHWND() ; if ( hEditWnd ) return ::SendMessage(hEditWnd, EM_CANUNDO, 0, 0) != 0; @@ -667,11 +670,10 @@ void wxComboBox::SetInsertionPointEnd() long wxComboBox::GetInsertionPoint() const { - // CB_GETEDITSEL returns the index of the last character after selection in - // its high-order word + // CB_GETEDITSEL returns the index of the first character of the selection in + // its low-order word DWORD pos= (DWORD)::SendMessage(GetHwnd(), CB_GETEDITSEL, 0, 0L); - - return HIWORD(pos); + return LOWORD(pos); } wxTextPos wxComboBox::GetLastPosition() const @@ -695,6 +697,10 @@ void wxComboBox::Replace(long from, long to, const wxString& value) // Paste into edit control SendMessage(GetHwnd(), WM_PASTE, (WPARAM)0, (LPARAM)0L); +#else + wxUnusedVar(from); + wxUnusedVar(to); + wxUnusedVar(value); #endif }