X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/cd4453e5889921086191e190e69745bd25b19bc1..ff3d11a0ab976879ff87c826f660786fee172ed9:/src/msw/window.cpp diff --git a/src/msw/window.cpp b/src/msw/window.cpp index 5b07081f99..e64c745c2d 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -47,8 +47,7 @@ #include "wx/button.h" #include "wx/msgdlg.h" #include "wx/settings.h" - - #include + #include "wx/statbox.h" #endif #if wxUSE_OWNER_DRAWN @@ -194,7 +193,7 @@ END_EVENT_TABLE() wxWindow *wxWindowMSW::FindItem(long id) const { #if wxUSE_CONTROLS - wxControl *item = wxDynamicThisCast(this, wxControl); + wxControl *item = wxDynamicCastThis(wxControl); if ( item ) { // is it we or one of our "internal" children? @@ -354,6 +353,17 @@ bool wxWindowMSW::Create(wxWindow *parent, { wxCHECK_MSG( parent, FALSE, wxT("can't create wxWindow without parent") ); +#if wxUSE_STATBOX + // wxGTK doesn't allow to create controls with static box as the parent so + // this will result in a crash when the program is ported to wxGTK - warn + // about it + // + // the correct solution is to create the controls as siblings of the + // static box + wxASSERT_MSG( !wxDynamicCastThis(wxStaticBox), + _T("wxStaticBox can't be used as a window parent!") ); +#endif // wxUSE_STATBOX + if ( !CreateBase(parent, id, pos, size, style, wxDefaultValidator, name) ) return FALSE; @@ -1777,7 +1787,7 @@ bool wxWindowMSW::MSWProcessMessage(WXMSG* pMsg) #if wxUSE_BUTTON else { - wxPanel *panel = wxDynamicThisCast(this, wxPanel); + wxPanel *panel = wxDynamicCastThis(wxPanel); wxButton *btn = NULL; if ( panel ) {