Professional UI Solutions
Site Map   /  Register


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 » CExtCmdManager remove items information Collapse All
Subject Author Date
Evgeniy Aleykin Sep 12, 2007 - 2:13 AM


can you please explain how to completely reset text properties from CExtCmdManager registred items. The problem is next: I have a menu (CExtMenuControlBar), and one of the items string has to be changed in run-time. As PROF_UIS uses customization, the item’s text will remain unchanged because it will be retrieved from CExtCmdItem registered object. This is a fragment from the lib source :

        CExtCmdItem * pCmdItem =
                g_CmdManager->ProfileNameFromWnd( hWndCmdProfileInfo ),

        if( ! pCmdItem->m_sMenuText.IsEmpty() )
            _sItemText = pCmdItem->m_sMenuText; <-------------------
        else if( ! pCmdItem->m_sToolbarText.IsEmpty() )
            _sItemText = pCmdItem->m_sToolbarText;

    SetPopupText( _sItemText ); // and this method will set registred items text, but not the new one...

Evgeniy Aleykin Sep 13, 2007 - 1:02 AM

Ok. The code I posted in previous post works well. The application works the way I want.

But if I switch to customizable menus and toolbars, how to perform this correctly.

Technical Support Sep 13, 2007 - 11:11 AM

In customizable applications, all toolbars and menus are based on CExtCustomizeCmdTreeNode command tree nodes. The command manager contains initial/default command properties (menu text, toolbar text, and icon). The command tree nodes contain current command properties and the user can rename a menu item/toolbar button and edit its icons. You should reset the command properties in the command manager in the same way and then reset all the command tree nodes corresponding to the same command. These actions are performed in the LanguageSwitcher customizable sample when the new UI language is selected.

Evgeniy Aleykin Sep 12, 2007 - 3:01 AM

I found a solution... the next code does what i was talkin about in previous post :

CExtCmdProfile * profile = g_CmdManager->ProfileGetPtr( g_CmdManager->ProfileNameFromWnd( AfxGetMainWnd()->m_hWnd ) );
CMap < UINT, UINT, CExtCmdItem *, CExtCmdItem * > & cmds = profile->m_cmds;
POSITION pos = cmds.GetStartPosition();
while( pos )
UINT key;
CExtCmdItem * value;
cmds.GetNextAssoc( pos, key, value );
value->m_sMenuText = _T("");

Is this right? Can I do so, or exists more convenient methods?

Technical Support Sep 12, 2007 - 1:30 PM

Your approach of resetting menu text of commands is absolutely correct only if you are not using customizable menus and toolbars. If you plan to switch to customizable menus and toolbars, we need to discuss some details of your project.