]> git.saurik.com Git - wxWidgets.git/commitdiff
fixd creation of controls with default initial size
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 20 Oct 2001 01:15:53 +0000 (01:15 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 20 Oct 2001 01:15:53 +0000 (01:15 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12104 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/control.cpp

index 8400508235ec803e079ca87ad09e2e8d73e94dbf..b3f223c21001b4a00493442be8363b60d0d567c4 100644 (file)
@@ -98,14 +98,18 @@ bool wxControl::MSWCreateControl(const wxChar *classname,
     // by default)
     style |= WS_CHILD | WS_VISIBLE;
 
+    int x = pos.x == -1 ? 0 : pos.x,
+        y = pos.y == -1 ? 0 : pos.y,
+        w = size.x == -1 ? 0 : size.x,
+        h = size.y == -1 ? 0 : size.y;
+
     m_hWnd = (WXHWND)::CreateWindowEx
                        (
                         exstyle,            // extended style
                         classname,          // the kind of control to create
                         label,              // the window name
                         style,              // the window style
-                        pos.x, pos.y,       // the window position
-                        size.x, size.y,     //            and size
+                        x, y, w, h,         // the window position and size
                         GetHwndOf(GetParent()),  // parent
                         (HMENU)GetId(),     // child id
                         wxGetInstance(),    // app instance
@@ -134,6 +138,12 @@ bool wxControl::MSWCreateControl(const wxChar *classname,
     // controls use the same font and colours as their parent dialog by default
     InheritAttributes();
 
+    // set the size now if no initial size specified
+    if ( w == 0 || h == 0 )
+    {
+        SetBestSize(size);
+    }
+
     return TRUE;
 }