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 » Closing menu on ribbon bar Collapse All
Subject Author Date
Lester Oidka Mar 8, 2009 - 10:26 AM

Hi,

I have tried to make an application which uses resource dlls and I’d like to switch them during runtime. It works but sometimes the menu opened from a ribbon bar button does not close and forces application to terminate.

I am looking in a way to terminate the menu before the language is switched. Calling the DestroyMenu seems to work just sometimes. If I add a delay it seems to work better - but do not want user to wait seconds for the swich. I just cant seem to find a way...

void TestApp::ChangeLanguage (UINT nID)
{
    CMenu * m = */this->m_wndRibbonBar.DestroyWindow();
    if (m) m->DestroyMenu();
    this->m_wndRibbonBar.EnableWindow(FALSE);

Sleep (5000); // with this delay it works better

    int selectLanguage = nID - ID_MENUITEMLANGUAGE1;
    std::list<TACLanguageDll> listing = TACLanguageHandler::GetLanguageList();

    std::list<TACLanguageDll>::iterator it = listing.begin();

    for (int i = 0; i < selectLanguage; i++) it++;

    TACLanguageHandler::SwitchLanguage(((DCSLanguageDll)*it).languageName);

    ///////////////////////////////////////////////////////////
    // update all controls on the main frame so the language specs are applied
    ReCreateFrame();

    ///////////////////////////////////////////////////////////
    /// update other controls
    m_pWndView->UpdateLanguageControls();
}

Technical Support Mar 9, 2009 - 10:37 AM

Please invoke the following code:

   CExtToolControlBar::_CloseTrackingMenus(); // immediately close menus displayed by toolbars
            CExtPopupMenuWnd::CancelMenuTracking(); // cancel any context menus
            CExtToolControlBar::_CloseCustomMenusAll(); // close menu like popup windows displayed by ribbons