- int h = ::SendMessage(GetHwnd(), CB_GETITEMHEIGHT, (WPARAM)-1, 0);
- SendMessage(GetHwnd(), CB_SETITEMHEIGHT, (WPARAM)-1, h + delta);
+ // size doesn't change, what about position?
+ int xCurrent, yCurrent;
+ DoGetPosition(&xCurrent, &yCurrent);
+ const bool defMeansUnchanged = !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE);
+ if ( ((x == wxDefaultCoord && defMeansUnchanged) || x == xCurrent)
+ &&
+ ((y == wxDefaultCoord && defMeansUnchanged) || y == yCurrent) )
+ {
+ // nothing changes, nothing to do
+ return;
+ }
+ }
+
+ // We cannot pass wxDefaultCoord as height to wxControl. wxControl uses
+ // wxGetWindowRect() to determine the current height of the combobox,
+ // and then again sets the combobox's height to that value. Unfortunately,
+ // wxGetWindowRect doesn't include the dropdown list's height (at least
+ // on Win2K), so this would result in a combobox with dropdown height of
+ // 1 pixel. We have to determine the default height ourselves and call
+ // wxControl with that value instead.
+ //
+ // Also notice that sometimes CB_GETDROPPEDCONTROLRECT seems to return
+ // wildly incorrect values (~32000) which looks like a bug in it, just
+ // ignore them in this case
+ RECT r;
+ if ( ::SendMessage(GetHwnd(), CB_GETDROPPEDCONTROLRECT, 0, (LPARAM) &r)
+ && r.bottom < 30000 )
+ {
+ height = heightCurrent + r.bottom - r.top;