X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3a7d5f7cc3892d15ee8de373b8ab52d4bc1eabf8..7330bb53dcadb06b7459f9fc99fd2e13e389db0a:/src/msw/combobox.cpp diff --git a/src/msw/combobox.cpp b/src/msw/combobox.cpp index 4c07746705..3b7515c645 100644 --- a/src/msw/combobox.cpp +++ b/src/msw/combobox.cpp @@ -127,7 +127,7 @@ LRESULT APIENTRY _EXPORT wxComboEditWndProc(HWND hWnd, // --------------------------------------------------------------------------- // the pointer to standard radio button wnd proc -static WXFARPROC gs_wndprocEdit = (WXFARPROC)NULL; +static WNDPROC gs_wndprocEdit = (WNDPROC)NULL; // ============================================================================ // implementation @@ -399,19 +399,18 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id, validator, name) ) return FALSE; - SetValue(value); + // we shouldn't call SetValue() for an empty read only combobox as it would + // (correctly) thro an assert and is otherwise useless anyhow + if ( n || !HasFlag(wxCB_READONLY) ) + SetValue(value); // a (not read only) combobox is, in fact, 2 controls: the combobox itself // and an edit control inside it and if we want to catch events from this // edit control, we must subclass it as well if ( !(style & wxCB_READONLY) ) { - gs_wndprocEdit = (WXFARPROC)::SetWindowLong - ( - (HWND)GetEditHWND(), - GWL_WNDPROC, - (LPARAM)wxComboEditWndProc - ); + gs_wndprocEdit = wxSetWindowProc((HWND)GetEditHWND(), + wxComboEditWndProc); } // and finally, show the control