I need under certain conditions to switch toolbars in my SDI application using the same CMFCToolBar object, which is the member of CMainFrame. I'm trying to do it like this:
void CMainFrame::ChangeTlbr(const int tlbIdx)
{
m_wndToolBar.ResetImages();
switch (tlbIdx)
{
case 0 :
m_wndToolBar.LoadToolBar(IDR_TLBR1);
break;
case 1:
m_wndToolBar.LoadToolBar(IDR_TLBR2);
break;
}
m_wndToolBar.Invalidate();
m_wndToolBar.UpdateWindow();
}
But bitmap of the next toolbar is not loaded.
What am i doing wrong in this case, and if there is better way to do this?
The following function shows how to replace the current toolbar by another one, defined as IDR_MAINFRAME1:
void CMainFrame::OnChangeToolbar()
{
m_wndToolBar.ResetAllImages();
m_wndToolBar.LoadToolBar(IDR_MAINFRAME1);
m_wndToolBar.LoadBitmap(IDR_MAINFRAME1);
m_wndToolBar.AdjustSizeImmediate();
}