The following routine in StdCtrls has a bug
procedure TCustomComboBox.AdjustDropDown;
var
DC: HDC;
SaveFont: HFont;
ItemCount: Integer;
Metrics: TTextMetric;
begin
DC := CreateCompatibleDC(0);
SaveFont := SelectObject(DC, Font.Handle);
GetTextMetrics(DC, Metrics);
SelectObject(DC, SaveFont);
DeleteDC(DC);
ItemCount := FItems.Count;
if ItemCount > DropDownCount then ItemCount := DropDownCount;
if ItemCount < 1 then ItemCount := 1;
SetWindowPos(Handle, 0, 0, 0, Width, Height + Metrics.tmHeight
*
ItemCount + 1, SWP_NOMOVE + SWP_NOZORDER + SWP_NOACTIVATE
+ // <-- on this line
SWP_NOREDRAW + SWP_HIDEWINDOW);
SetWindowPos(Handle, 0, 0, 0, 0, 0, SWP_NOMOVE + SWP_NOSIZE
+
SWP_NOZORDER + SWP_NOACTIVATE + SWP_NOREDRAW + SWP_SHOWWINDOW);
end;
The line should read
(ItemCount + 1), SWP_NOMOVE + SWP_NOZORDER + SWP_NOACTIVATE
+
^
^
|
|
Note the open & close paren. The effect
of this bug is to force the Combo box to always show a scroll bar when
dropped down, regardless of how many items are supposed to show.