Forum
Please
Log In
to post a new message or reply to an existing one. If you are not registered, please
register.
NOTE: Some forums may be read-only if you are not currently subscribed to
our technical support services.
Subject |
Author |
Date |
|
Chris Anderson
|
Apr 23, 2007 - 5:14 PM
|
I have a popup menu which is dynamically populated with menu items based on application context. In some cases there will not be any menu items for this popup menu. In this case I need to disable the popup menu. How would I go about doing this?
|
|
Technical Support
|
Apr 25, 2007 - 12:05 PM
|
To disable the entire popup menu, you should handle the CExtPopupMenuWnd::g_nMsgPrepareOneMenuLevel registered message. The code below disables the Toolbars sub menu. LRESULT CMainFrame::OnExtMenuPrepare(WPARAM wParam, LPARAM lParam)
{
CExtPopupMenuWnd::MsgPrepareMenuData_t * pData =
reinterpret_cast
< CExtPopupMenuWnd::MsgPrepareMenuData_t * >
( wParam );
ASSERT( pData != NULL );
CExtPopupMenuWnd * pPopup = pData->m_pPopup;
ASSERT( pPopup != NULL );
INT nItemPos = pPopup->ItemFindByText( _T("&Toolbars") );
if( nItemPos > 0 )
{
CExtPopupMenuWnd::MENUITEMDATA & _mii = pPopup->ItemGetInfo( nItemPos );
if( _mii.IsPopup() )
_mii.SetForcePopupDisabled( true );
}
return 1L;
}
|
|