From: Dimitri Schoolwerth Date: Mon, 31 Oct 2011 11:30:45 +0000 (+0000) Subject: Fixed dropdown height of wxChoice and wxComboBox controls. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/275c64304eadef874676ab4aa3663a0f8feefd5d Fixed dropdown height of wxChoice and wxComboBox controls. When using comctl32.dll versions prior to 6.0 (e.g. with Win2k or no manifest file) the dropdown height of a wxChoice and wxComboBox would show all but one item and a vertical scrollbar was always visible. Fixed by reintroducing code that adds 1 to the total number of items. The code got dropped in r60553, added a comment to it in the hope that it will not be lost again. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69612 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/msw/choice.cpp b/src/msw/choice.cpp index 03d3b3fb50..3fd0fefc5a 100644 --- a/src/msw/choice.cpp +++ b/src/msw/choice.cpp @@ -544,7 +544,10 @@ void wxChoice::DoSetSize(int x, int y, const int hItem = SendMessage(GetHwnd(), CB_GETITEMHEIGHT, 0, 0); int heightWithItems = 0; if (!HasFlag(wxCB_SIMPLE)) - heightWithItems = height + hItem*nItems; + // The extra item (" + 1") is required to prevent a vertical + // scrollbar from appearing with comctl32.dll versions earlier + // than 6.0 (such as found in Win2k). + heightWithItems = height + hItem*(nItems + 1); else heightWithItems = SetHeightSimpleComboBox(nItems);