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 » Change toolbar dynamically Collapse All
Subject Author Date
jb lee Aug 22, 2006 - 4:02 AM

Can I change the toolbar content with another toolbar resource dynamically?

I tried the code(below), It looks like working well(sometimes, the icons are not shown).

void CToolbartestView::OnButton1()
{
    CMainFrame* pFrame = (CMainFrame*)AfxGetMainWnd();

    pFrame->m_wndToolBar.LoadToolBar(IDR_TOOLBAR1);
    if(pFrame->m_wndToolBar .IsVisible() ){
                pFrame->m_wndToolBar.GetParentFrame()->RecalcLayout();
                pFrame->m_wndToolBar.Invalidate();
                pFrame->m_wndToolBar.UpdateWindow();
            }
}

Technical Support Aug 22, 2006 - 6:51 AM

The icons will be displayed OK if your toolbars have their own unique command identifiers for all their buttons. The alternative approach is to update your command manager from all the toolbar resources and invoke the CExtToolControlBar::SetButtons() and CExtToolControlBar::InitContentExpandButton() methods instead of the CExtToolControlBar::LoadToolBar() method. This will work faster.

jb lee Oct 6, 2006 - 9:07 AM

Would you help me?
It’s very urgent.

This code doesn’t refresh the toolbar.
The changed icons are drawn when I resize the toolbar by dragging the boundary.

Technical Support Oct 9, 2006 - 8:51 AM

Would you send us your test project which demonstrates the problem so we can figure out what is wrong?