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 » CExtMenuControlBar.SetMdiWindowPopupName Collapse All
Subject Author Date
Barbara Roth Mar 28, 2012 - 1:17 PM

I have an MDI application.  I want to show a list of the currenly open MDI windows, so I call SetMdiWindowPopupName which does show all the open MDI windows.  Is their a simple method that I can use to pick and choose which MDI windows I want to show if I don’t want to show all of them?


 


 

Technical Support Apr 2, 2012 - 2:42 PM

You should avoid using the SetMdiWindowPopupName() API and implement MDI window list from scratch. Please insert some command item into any menu(s) where you want to see MDI window list. This command item we call marker item because your app will search it for removing and inserting a set of MDI menu items instead of it. So, the first thing you need is to add message handler for the CExtPopupMenuWnd::g_nMsgPrepareOneMenuLevel message into your main frame class:

    ON_REGISTERED_MESSAGE( CExtPopupMenuWnd::g_nMsgPrepareOneMenuLevel, 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 );
    
    for( INT nReplacePos = pPopup->ItemFindPosForCmdID( ID_MY_MARKER_MENU_ITEM ); nReplacePos >= 0; nReplacePos = pPopup->ItemFindPosForCmdID( ID_MY_MARKER_MENU_ITEM ) )
    {
        VERIFY( pPopup->ItemRemove( nReplacePos ) );
//
// TO-DO: detect all required MDI documents and insert appropriate menu items into nReplacePos position of the pPopup menu here
//
    } // if( nReplacePos >= 0 )
    return 1L;
}

The standard MDI menu command items are sequential starting from the __ID_MDIWNDLIST_FIRST identifier. The maximum command count is __ID_MDIWNDLIST_COUNT. These commands are handled automatically. But you cannot use these command identifiers because your MDI menu contains only optionally selected MDI windows. This means you should use your own range of commands and handle them manually in main frames OnCmdMsg() virtual method.