Ensure wxChoice reported width never becomes negative in wxMSW.

Don't set the pending size to (-1, valid-height) as it is always supposed to
be either fully valid or fully invalid (meaning there is no pending size
change).

Closes #15723.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@75654 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2014-01-20 14:44:44 +00:00
parent 0997127e37
commit ddd761f2d9

View File

@@ -533,15 +533,16 @@ void wxChoice::DoSetSize(int x, int y,
int width, int height,
int sizeFlags)
{
const int heightBest = GetBestSize().y;
// The height of the control itself, i.e. of its visible part.
int heightVisible = height;
// we need the real height below so get the current one if it's not given
if ( height == wxDefaultCoord )
{
// height not specified, use the same as before
DoGetSize(NULL, &height);
DoGetSize(NULL, &heightVisible);
}
else if ( height == heightBest )
else if ( height == GetBestSize().y )
{
// we don't need to manually manage our height, let the system use the
// default one
@@ -585,7 +586,7 @@ void wxChoice::DoSetSize(int x, int y,
// 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);
heightWithItems = heightVisible + hItem*(nItems + 1);
else
heightWithItems = SetHeightSimpleComboBox(nItems);