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 » Modification command menu dynamically on multi window application Collapse All
Subject Author Date
Xavier Caroff Oct 31, 2007 - 11:30 AM

Hello,

We have a multi-window application. We can load in a frame different types of document, and the menu is modified dynamically according to the document loaded.

The problem is when we change dynamically a menu command (just the label), all the opening frame are impacted.

All the frames of the application are derived to CExtNCW.
In the fonction "OnCreate" we use the fonction "ProfileSetup" with the same name of profile.

For the dynamic modification of the menu we use :

CExtCmdItem* l_P_O_item = g_CmdManager->CmdGetPtr(F_getProfileName(), ID_VIEW_LAYER0);

if (l_P_O_item != NULL)
{
    l_P_O_item->m_sMenuText = l_O_texte;
}

Have you a solution for us?

Best Regards,

Renaud Ixsea

Technical Support Nov 1, 2007 - 8:37 AM

Your message contains an answer to your question. Both menus and toolbars are based on command descriptions in the command manager. I.e. menu items do not have text and get it from CExtCmdItem objects stored in the command manager. But you created several windows with their menus and attached all of them to the same command profile in the command manager. As a result, menu items with the same identifier in different windows have the same text. You should make all your windows using different command profiles at runtime. You can even create and initialize them by using the command profile with one statically known name and then rename the command profile using the CExtCmdManager::ProfileRename() API. When some window is destroyed, it can rename the command profile back to the statically known name. As a result, all the windows will load/save one command profile, but will use different command profiles at run time.