]> git.saurik.com Git - wxWidgets.git/commitdiff
fix for the initial size of the dialogs
authorVadim Zeitlin <vadim@wxwidgets.org>
Thu, 18 Oct 2001 23:18:34 +0000 (23:18 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Thu, 18 Oct 2001 23:18:34 +0000 (23:18 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12079 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/toplevel.cpp

index 91d64f0d372217655854322f15d4f1db42a17c3c..0720766612eb0417614886e0784f9396c58661bf 100644 (file)
@@ -244,6 +244,20 @@ bool wxTopLevelWindowMSW::CreateDialog(const wxChar *dlgTemplate,
     int x, y, w, h;
     if ( MSWGetCreateWindowCoords(pos, size, x, y, w, h) )
     {
+        // we can't use CW_USEDEFAULT here as we're not calling CreateWindow()
+        // and passing CW_USEDEFAULT to MoveWindow() results in resizing the
+        // window to (0, 0) size which breaks quite a lot of things, e.g. the
+        // sizer calculation in wxSizer::Fit()
+        if ( w == CW_USEDEFAULT )
+        {
+            // the exact number doesn't matter, the dialog will be resized
+            // again soon anyhow but it should be big enough to allow
+            // calculation relying on "totalSize - clientSize > 0" work, i.e.
+            // at least greater than the title bar height
+            w =
+            h = 100;
+        }
+
         if ( !::MoveWindow(GetHwnd(), x, y, w, h, FALSE) )
         {
             wxLogLastError(wxT("MoveWindow"));