]> git.saurik.com Git - wxWidgets.git/commitdiff
create controls with 1*1 size by default, not 0*0 as it wreaks havoc with wxRect...
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 12 Dec 2004 18:56:36 +0000 (18:56 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 12 Dec 2004 18:56:36 +0000 (18:56 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30964 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/control.cpp

index 3ab9e10eea79b20174c9862be1d58360fd9a2d16..fa80b56493f8db69bced81aa6ddbcc7ba63bb68a 100644 (file)
@@ -126,11 +126,15 @@ bool wxControl::MSWCreateControl(const wxChar *classname,
         style |= WS_VISIBLE;
     }
 
-    // choose the position for the control
+    // choose the position for the control: we have a problem with default size
+    // here as we can't calculate the best size before the control exists
+    // (DoGetBestSize() may need to use m_hWnd), so just choose the minimal
+    // possible but non 0 size because 0 window width/height result in problems
+    // elsewhere
     int x = pos.x == wxDefaultCoord ? 0 : pos.x,
         y = pos.y == wxDefaultCoord ? 0 : pos.y,
-        w = size.x == wxDefaultCoord ? 0 : size.x,
-        h = size.y == wxDefaultCoord ? 0 : size.y;
+        w = size.x == wxDefaultCoord ? 1 : size.x,
+        h = size.y == wxDefaultCoord ? 1 : size.y;
 
     // ... and adjust it to account for a possible parent frames toolbar
     AdjustForParentClientOrigin(x, y);