From 2626810054279cf4eb22a3882c0d3941f2540a3e Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Thu, 18 Mar 2004 19:02:01 +0000 Subject: [PATCH] Restored part of the default positioning code for dialogs that I 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 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/msw/toplevel.cpp b/src/msw/toplevel.cpp index 7246affec8..eaa89292ad 100644 --- a/src/msw/toplevel.cpp +++ b/src/msw/toplevel.cpp @@ -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")); -- 2.45.2