From: Stefan Csomor Date: Tue, 28 Jan 2003 12:26:43 +0000 (+0000) Subject: static box parent warning added X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/01fbf5d755c82a33f71549eaa6b4ecf52a211eda static box parent warning added git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@18981 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/mac/carbon/window.cpp b/src/mac/carbon/window.cpp index c0a47faa5f..cf5a48692c 100644 --- a/src/mac/carbon/window.cpp +++ b/src/mac/carbon/window.cpp @@ -197,6 +197,17 @@ bool wxWindowMac::Create(wxWindowMac *parent, wxWindowID id, { wxCHECK_MSG( parent, FALSE, wxT("can't create wxWindowMac 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( !wxDynamicCast(parent, 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; diff --git a/src/mac/window.cpp b/src/mac/window.cpp index c0a47faa5f..cf5a48692c 100644 --- a/src/mac/window.cpp +++ b/src/mac/window.cpp @@ -197,6 +197,17 @@ bool wxWindowMac::Create(wxWindowMac *parent, wxWindowID id, { wxCHECK_MSG( parent, FALSE, wxT("can't create wxWindowMac 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( !wxDynamicCast(parent, 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;