]> git.saurik.com Git - wxWidgets.git/commitdiff
Restored part of the default positioning code for dialogs that I
authorRobin Dunn <robin@alldunn.com>
Thu, 18 Mar 2004 19:02:01 +0000 (19:02 +0000)
committerRobin Dunn <robin@alldunn.com>
Thu, 18 Mar 2004 19:02:01 +0000 (19:02 +0000)
removed a few days ago.

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

src/msw/toplevel.cpp

index 7246affec86b384874db50edad8c57ba91d14a25..eaa89292adcc4f25c5e26a2d530d93398e0768b2 100644 (file)
@@ -394,6 +394,15 @@ bool wxTopLevelWindowMSW::CreateDialog(const void *dlgTemplate,
     int x, y, w, h;
     (void)MSWGetCreateWindowCoords(pos, size, x, y, w, h);
 
+    if ( x == (int)CW_USEDEFAULT )
+    {
+        // centre it on the screen - what else can we do?
+        wxSize sizeDpy = wxGetDisplaySize();
+
+        x = (sizeDpy.x - w) / 2;
+        y = (sizeDpy.y - h) / 2;
+    }
+
     if ( !::MoveWindow(GetHwnd(), x, y, w, h, FALSE) )
     {
         wxLogLastError(wxT("MoveWindow"));