]> git.saurik.com Git - wxWidgets.git/commitdiff
don't let wxChoice created with default size to shrink to nothing in a sizer
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 2 May 2004 16:06:51 +0000 (16:06 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 2 May 2004 16:06:51 +0000 (16:06 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27065 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/choice.cpp

index 1d1cd38aac66068d66f3727886577eb47f2c6eb8..0d9a34a4d548bf77351262766b0a5032a5482eca 100644 (file)
@@ -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;