X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8d99be5f5381dad56492da02c2df1c3ec0750926..de3131e78406c3d8a4fb5c1fdf91fbeccfe63f73:/src/msw/choice.cpp diff --git a/src/msw/choice.cpp b/src/msw/choice.cpp index 92cab89387..84d90c83b0 100644 --- a/src/msw/choice.cpp +++ b/src/msw/choice.cpp @@ -60,7 +60,7 @@ bool wxChoice::Create(wxWindow *parent, if ( !CreateControl(parent, id, pos, size, style, validator, name) ) return FALSE; - long msStyle = WS_CHILD | CBS_DROPDOWNLIST | WS_TABSTOP | WS_VISIBLE; + long msStyle = WS_CHILD | CBS_DROPDOWNLIST | WS_TABSTOP | WS_VISIBLE | WS_HSCROLL | WS_VSCROLL; if ( style & wxCB_SORT ) msStyle |= CBS_SORT; @@ -154,15 +154,15 @@ int wxChoice::FindString(const wxString& s) const wxString wxChoice::GetString(int n) const { size_t len = (size_t)::SendMessage(GetHwnd(), CB_GETLBTEXTLEN, n, 0); - wxString str; - if ( ::SendMessage(GetHwnd(), CB_GETLBTEXT, n, - (LPARAM)str.GetWriteBuf(len)) == CB_ERR ) - { - wxLogLastError("SendMessage(CB_GETLBTEXT)"); + wxString str = ""; + if (len) { + if ( ::SendMessage(GetHwnd(), CB_GETLBTEXT, n, + (LPARAM)str.GetWriteBuf(len)) == CB_ERR ) { + wxLogLastError("SendMessage(CB_GETLBTEXT)"); + } + str.UngetWriteBuf(); } - str.UngetWriteBuf(); - return str; } @@ -186,7 +186,7 @@ void* wxChoice::DoGetClientData( int n ) const wxLogLastError(_T("CB_GETITEMDATA")); // unfortunately, there is no way to return an error code to the user - rc = NULL; + rc = (LPARAM) NULL; } return (void *)rc;