X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4438caf41af49f00f3c8137ac801871f59cce386..f38374d0d7aa865e9bbe8ee61b75b94ffcdfb220:/src/msw/combobox.cpp?ds=inline diff --git a/src/msw/combobox.cpp b/src/msw/combobox.cpp index 7104620710..0593b9342e 100644 --- a/src/msw/combobox.cpp +++ b/src/msw/combobox.cpp @@ -38,11 +38,14 @@ bool wxComboBox::MSWCommand(WXUINT param, WXWORD WXUNUSED(id)) { if (param == CBN_SELCHANGE) { - wxCommandEvent event(wxEVT_COMMAND_COMBOBOX_SELECTED, m_windowId); - event.SetInt(GetSelection()); - event.SetEventObject(this); - event.SetString(GetStringSelection()); - ProcessCommand(event); + if (GetSelection() > -1) + { + wxCommandEvent event(wxEVT_COMMAND_COMBOBOX_SELECTED, m_windowId); + event.SetInt(GetSelection()); + event.SetEventObject(this); + event.SetString(GetStringSelection()); + ProcessCommand(event); + } return TRUE; } @@ -73,7 +76,6 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id, if (parent) parent->AddChild(this); SetBackgroundColour(parent->GetBackgroundColour()) ; SetForegroundColour(parent->GetForegroundColour()) ; - m_noStrings = 0; m_windowStyle = style; @@ -87,8 +89,8 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id, int width = size.x; int height = size.y; - long msStyle = WS_CHILD | WS_HSCROLL | WS_VSCROLL | - WS_TABSTOP | WS_VISIBLE | CBS_NOINTEGRALHEIGHT; + long msStyle = WS_CHILD | WS_TABSTOP | WS_VISIBLE | WS_HSCROLL | WS_VSCROLL | + CBS_NOINTEGRALHEIGHT; if (m_windowStyle & wxCB_READONLY) msStyle |= CBS_DROPDOWNLIST; @@ -108,12 +110,12 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id, if ( want3D || wxStyleHasBorder(m_windowStyle) ) msStyle |= WS_BORDER; - m_hWnd = (WXHWND)::CreateWindowEx(exStyle, _T("COMBOBOX"), NULL, + m_hWnd = (WXHWND)::CreateWindowEx(exStyle, wxT("COMBOBOX"), NULL, msStyle, 0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)m_windowId, wxGetInstance(), NULL); - wxCHECK_MSG( m_hWnd, FALSE, _T("Failed to create combobox") ); + wxCHECK_MSG( m_hWnd, FALSE, wxT("Failed to create combobox") ); /* #if wxUSE_CTL3D @@ -323,15 +325,6 @@ void wxComboBox::DoSetSize(int x, int y, int sizeFlags) { wxControl::DoSetSize(x, y, width, height, sizeFlags); - - // VZ: for unknown (to me) reasons, if we don't do this, the combobox - // somehow is hidden by the static boxes, although static boxes do - // put themselves at the very end of Z-order. - if ( !::SetWindowPos(GetHwnd(), HWND_BOTTOM, 0, 0, 0, 0, - SWP_NOMOVE | SWP_NOSIZE) ) - { - wxLogLastError(_T("SetWindowPos")); - } } #endif