From: Václav Slavík Date: Wed, 19 Oct 2011 16:19:58 +0000 (+0000) Subject: Fix NULL window argument to wxEVT_KILL_FOCUS when creating a TLW. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/8df14bedf50602c1882fdb318e310ace09284554 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 --- 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);