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 General Discussion » About class CExtPopupMenuWnd Collapse All
Subject Author Date
Yang Richard Aug 21, 2008 - 2:04 AM

Hi Tech-Support,


In our company product, we create some customize menuitems with CExtPopupMenuWnd in OnExtMenuPrepare(), The code is like as below :


CExtPopupMenuWnd::MsgPrepareMenuData_t *pData = reinterpret_cast < CExtPopupMenuWnd::MsgPrepareMenuData_t *> (wParam);


ASSERT(pData != NULL);


CExtPopupMenuWnd *pPopup = pData->m_pPopup;


ASSERT(pPopup != NULL);


INT nItemPos = 0;


INT nNewPos = -1;


if (m_uLocatePosId != 0)  //m_uLocatePosId is a special insert position


{


    nItemPos = pPopup->ItemFindPosForCmdID(m_uLocatePosId);


    if (nItemPos > 0)


    {


         nNewPos = nItemPos;


    }


    if (nNewPos > 0)


   {


        VERIFY(g_CmdManager->UpdateFromMenu(AfxGetApp()->m_pszProfileName, IDR_XX_MENU);


        if (pPopup->ItemGetCount() - 1 <= nNewPos || pPopup->ItemGetPopup(nNewPos) == NULL)


       {


             CExtPopupMenuWnd* pXXMenu = new CEXtPopupMenuWnd();


             pXXMenu->LoadMenu(this->GetSafeWnd(), IDR_XX_MENU);


             char buf[MAX_SIZE] = "\0";


             LoadString(GetAppFrameInstance(), IDS_XX_MENU, buf, MAX_SIZE);


             VERIFY(pPopup->ItemInsertSpecPopup(pXXMenu, nNewPos+1, buf));


       }


}


The problem is when I click the menuitem, I can’t see the check status of the menuitem. (I have implemented the OnUpdateMenu for the menuitem)


The OnUpdateMenu is like as below:


void CXXWnd::OnUpdateMenu(CCmdUI* pCmdUI)


{


      pCmdUI->Enable();


      pCmdUI->SetCheck(m_bChecked);    


}


I would appreciate it if you can give me some help.

Technical Support Aug 21, 2008 - 1:31 PM

If the CXXWnd::OnUpdateMenu() method is bound to some menu command item which has exactly the same identifier as used in the message map entry for the CXXWnd::OnUpdateMenu() method, the you should see check mark. You can check this by setting break point to the CXXWnd::OnUpdateMenu() method and it should be invoked. Please check additionally the following:

-- If the OnExtMenuPrepare() handler method modifies popup menu, then it MUST invoke the pData->m_bMenuChanged = true; code which will inform the popup menu about menu layout changing and make it re-updating menu commands.</li>
--Of course, you should check all the command routes in your project are working correctly.</li>