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 » MRU menu not updating correctly Collapse All
Subject Author Date
Andrey Del Pozo Apr 17, 2004 - 5:03 PM

Greetings, i am trying to implement MRUs for to diferen types of docs in my app, for that i’m using the class that appered in the C++ Q/A column of the issue of August/1999 of the MSJ. The problem is that the first time the popup menu is displayed the items are not show correctly but if you dismiss the menu and view it again the item are right. Is there a way to force and update of the menu for the handler of ON_UPDATE_COMMAND_UI or this is not the place to doit? 


Thanks in advance,


Andrey

Technical Support Apr 19, 2004 - 9:54 AM

Dear Andrey,

To help you, we need to take a look at your source code. Please send us your test project or at least the source code that updates the menu.

We recommend you not to use CCmdUI-updating methods for any kind of dynamic menu construction. The most effective way to initialize the Prof-UIS menus dynamically is to add a handler method for the CExtPopupMenuWnd::g_nMsgPrepareMenu registered Windows message:

 
 ON_REGISTERED_MESSAGE(
  CExtPopupMenuWnd::g_nMsgPrepareMenu,
  OnExtMenuPrepare
  )
LRESULT CMainFrame::OnExtMenuPrepare(WPARAM wParam, LPARAM lParam)
{
 lParam;
CExtPopupMenuWnd::MsgPrepareMenuData_t * pData =
  reinterpret_cast
   < CExtPopupMenuWnd::MsgPrepareMenuData_t * >
   ( wParam );
 ASSERT( pData != NULL );
CExtPopupMenuWnd * pPopup = pData->m_pPopup;
 ASSERT( pPopup != NULL );
....

You can modify the pPopup submenu (including inner sub menus) here. For example, you can insert some command like ID_FILE_MRU_FIRST to the menu resource and replace it dynamically with other menu items or sub menus.