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 » Can`t change top level menu dynamically Collapse All
Subject Author Date
Artur Shingirei Feb 19, 2004 - 4:08 AM

Hello.
I have confronted with a problem.
I have menu created with using Your library (CMyMenuControlBar).
Now I want to change(dynamically) some Item(text) in top level menu.
I have created ID for FILE item(ID_FILE_TOP)
I have overrided handler for Item File.
void CMainDlg::OnFileTop(CCmdUI *pCmdUI)
{
if(bInitComplite == true)
pCmdUI->SetText(“Change File”);
}
but nothing result.
I did add in Your Sample "ProfUIS_Controls" one Item in the menu, and do the same, also nothing.
Thank You.

Sergiy Lavrynenko Feb 20, 2004 - 3:46 AM

Dear Artur,


The CCmdUI::SetText() method is used to assign a new text string to some command(s) in the menu. The CExtMenuControlBar class is a kind of the Prof-UIS toolbar (CExtToolControlBar). The top level menu items are toolbar buttons. To assign new text to toolbar buttons, you should use the command manager:

        CExtCmdItem * pCmdItem =
                g_CmdManager->CmdGetPtr(
                        g_CmdManager->ProfileNameFromWnd(
                                m_wndMenuBar.GetSafeHwnd()
                                ),
                        ID_FILE_TOP
                        );
        ASSERT( pCmdItem != NULL );
        pCmdItem->m_sToolbarText =
                 _T("New text in toolbar or menu bar");
        if( m_wndMenuBar.IsVisible() )
                m_wndMenuBar.GetParentFrame()->RecalcLayout();

Best regards, Sergiy.

Artur Shingirei Feb 23, 2004 - 2:54 AM

Hi. Thank`s for your fast replay.
Is exist another way to get the pCmdItem pointer?
if I has no ID for menu Item. (Top Level menu) I know only the position of the button.

Artur Shingirei Feb 23, 2004 - 3:12 AM

I did the following:
CExtBarButton * pExtButton = NULL;
    UINT nID;
    pExtButton = m_wndMenuBar.GetButton(0);
    nID = pExtButton->GetCmdID();
    CExtCmdItem * pCmdItem =
    
        g_CmdManager->CmdGetPtr(

g_CmdManager->ProfileNameFromWnd(

m_wndMenuBar.GetSafeHwnd()

),

                                nID

);

is this correct?