From 8df14bedf50602c1882fdb318e310ace09284554 Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Wed, 19 Oct 2011 16:19:58 +0000 Subject: [PATCH] Fix NULL window argument to wxEVT_KILL_FOCUS when creating a TLW. wxTopLevelWindowMSW::CreateDialog first moved and resized the newly created window and only then called SubclassWin(). Because native focus change occurred when moving the window, HWND->wxWindow association wasn't yet filled in and wxFindWinFromHandle() would return NULL. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69469 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/toplevel.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/msw/toplevel.cpp b/src/msw/toplevel.cpp index f7329fe3c0..8378923a5c 100644 --- a/src/msw/toplevel.cpp +++ b/src/msw/toplevel.cpp @@ -445,6 +445,13 @@ bool wxTopLevelWindowMSW::CreateDialog(const void *dlgTemplate, } #endif // !__WXWINCE__ + if ( !title.empty() ) + { + ::SetWindowText(GetHwnd(), title.wx_str()); + } + + SubclassWin(m_hWnd); + #if !defined(__WXWINCE__) || defined(__WINCE_STANDARDSDK__) // move the dialog to its initial position without forcing repainting int x, y, w, h; @@ -466,13 +473,6 @@ bool wxTopLevelWindowMSW::CreateDialog(const void *dlgTemplate, } #endif // !__WXWINCE__ - if ( !title.empty() ) - { - ::SetWindowText(GetHwnd(), title.wx_str()); - } - - SubclassWin(m_hWnd); - #ifdef __SMARTPHONE__ // Work around title non-display glitch Show(false); -- 2.47.2