Instead of using GetAdjustedBestSize use the minsize if there is one,
authorRobin Dunn <robin@alldunn.com>
Thu, 22 Apr 2004 21:44:29 +0000 (21:44 +0000)
committerRobin Dunn <robin@alldunn.com>
Thu, 22 Apr 2004 21:44:29 +0000 (21:44 +0000)
otherwise use GetBestSize.  This allows for situations where the
minsize is smaller than the bestsize (for example, abbreviated state
fields will normally be smaller than the 100px best size for
wxTextCtrls.)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26918 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/sizer.cpp

index 062e2767d59c4c48bf91b8765a476cbb60165c1d..c2320a4d5aaa093e47249dde4b7b06f739297e20 100644 (file)
@@ -195,9 +195,14 @@ wxSize wxSizerItem::CalcMin()
     {
         if ( IsWindow() && !(m_flag & wxFIXED_MINSIZE) )
         {
-            // the size of the window may change during run-time, we should
-            // use the current minimal size
-            m_minSize = m_window->GetAdjustedBestSize();
+            // Since the size of the window may change during runtime, we
+            // should use the current minimal size.  If there is a MinSize,
+            // use it, otherwise use the BestSize.
+            wxSize min  = m_window->GetMinSize();
+            wxSize best = m_window->GetBestSize();
+            if (min.x == -1) min.x =  best.x;
+            if (min.y == -1) min.y =  best.y;
+            m_minSize = min;
         }
 
         ret = m_minSize;