From 25736956ef75bc3ebc0d469233c9b6f67bf3c087 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 2 May 2004 16:06:51 +0000 Subject: [PATCH] don't let wxChoice created with default size to shrink to nothing in a sizer git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27065 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/choice.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/msw/choice.cpp b/src/msw/choice.cpp index 1d1cd38aac..0d9a34a4d5 100644 --- a/src/msw/choice.cpp +++ b/src/msw/choice.cpp @@ -182,7 +182,19 @@ bool wxChoice::CreateAndInit(wxWindow *parent, // and now we may finally size the control properly (if needed) if ( autoSize ) { - SetBestSize(sizeOrig); + // we do the same thing as SetBestSize() but we need sizeBest here + wxSize sizeBest = DoGetBestSize(); + if ( size.x != -1 ) + sizeBest.x = sizeOrig.x; + if ( size.y != -1 ) + sizeBest.y = sizeOrig.y; + + SetSize(sizeBest); + + // this is our true initial size, not the (1, 1) we had during + // CreateControl() call above: this is especially important if we're + // added to a sizer as we don't want to be shrunk to nothing by it + m_initialSize = sizeBest; } return TRUE; -- 2.47.2