From: andrew7 <bd...@us...> - 2006-11-30 00:42:41
|
Update of /cvsroot/smartwin/SmartWin/include/smartwin/widgets In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv20958/include/smartwin/widgets Modified Files: WidgetMenu.h Log Message: Change to keep these out of itsChildren so WidgetModalDialog works. Index: WidgetMenu.h =================================================================== RCS file: /cvsroot/smartwin/SmartWin/include/smartwin/widgets/WidgetMenu.h,v retrieving revision 1.29 retrieving revision 1.30 diff -u -d -r1.29 -r1.30 --- WidgetMenu.h 5 May 2006 17:14:42 -0000 1.29 +++ WidgetMenu.h 30 Nov 2006 00:42:36 -0000 1.30 @@ -268,7 +268,11 @@ WidgetMenuPtr appendPopup( const SmartUtil::tstring & name ) { HMENU handle = reinterpret_cast< HMENU >( this->Widget::itsHandle ); - WidgetMenuPtr retVal = WidgetMenuPtr( new WidgetMenu< EventHandlerClass, MessageMapPolicy >( this->Widget::itsParent ) ); + +// WidgetMenuPtr retVal = WidgetMenuPtr( new WidgetMenu< EventHandlerClass, MessageMapPolicy >( this->Widget::itsParent ) ); +// Should it be the below instead ? + WidgetMenuPtr retVal = WidgetMenuPtr( new WidgetMenu< EventHandlerClass, MessageMapPolicy >( this ) ); + retVal->create(); ::AppendMenu( handle, MF_POPUP, reinterpret_cast< unsigned int >( retVal->handle() ), name.c_str() ); itsChildren.push_back( retVal ); @@ -668,13 +672,17 @@ template< class EventHandlerClass, class MessageMapPolicy > WidgetMenu< EventHandlerClass, MessageMapPolicy >::WidgetMenu( SmartWin::Widget * parent ) - : Widget( parent ) + : Widget( 0 ) , isSysMenu( false ) { - // Can't have a text box without a parent... + // We construct Widget(0) so that the WidgetMenu is not placed in parent->itsChildren + // (If a WidgetMenu is in parent->Children then WidgetModalDialog crashs during cleanup. xAssert( parent, _T( "Can't have a Menu without a parent..." ) ); + this->Widget::itsParent= parent; // But eventually we do want to know its parent. } + + // end namespace SmartWin } |