Professional UI Solutions
Site Map   /  Register
 
 

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.

Forums » Prof-UIS Tech Support » Variable main menu Collapse All
Subject Author Date
Holger Hellenschmidt May 23, 2005 - 12:54 AM

Hi,


I want to implement a variable main menu which has a different edit menu depending on the current selection in a grid. I have tried to replace the default menu in CMainFrame::OnExtMenuPrepare, but got a lot of asserts:


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 nDummyPos = pPopup->ItemFindPosForCmdID(ID_MENU_DUMMY);
 if (( nDummyPos >= 0 ) && ( m_nEditMenuID > 0 ))
 {
  delete pPopup;
  pData->m_pPopup = new CExtPopupMenuWnd;
  pData->m_pPopup->LoadMenu( m_hWnd, m_nEditMenuID, false );


Any idea?

Technical Support May 24, 2005 - 7:46 AM

You should not delete the pData->m_pPopup menu instance. That is not correct. Please remove all the items from this pop-up menu and load the menu resource into it.