I created the status bar CStatusBar statusBar;
in the class CMainFrame : public CFrameWnd
class
and I am doing that:
if (!statusBar.CreateEx(this, TBSTYLE_AUTOSIZE, WS_CHILD | CBRS_TOP | WS_VISIBLE | CBRS_GRIPPER) ||
!statusBar.LoadToolBar(IDR_TOOLBAR))
{
return -1;
}
if (!statusBar.CreateEx(this, SBARS_TOOLTIPS, WS_CHILD | WS_VISIBLE | CBRS_BOTTOM | CBRS_GRIPPER))
{
return -1;
}
statusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT));
// and then trying:
statusBar.EnableDocking(CBRS_ALIGN_BOTTOM); // here I recieve an assertion
EnableDocking(CBRS_ALIGN_BOTTOM);
DockControlBar(&statusBar);
What is the wrong here (Almost the same behaviour works for tool bar)? And Is it possible to make a status bar with enabled docking ?
I beelieve it is possible cause I have this in the picture:
]1
UPD
It is what I have in the code :
if (!m_wndStatusBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_BOTTOM | CBRS_GRIPPER | CBRS_FLYBY | CBRS_SIZE_DYNAMIC))
{
TRACE0("Не удалось создать строку состояния\n");
return -1;
}
m_wndStatusBar.SetIndicators(indicators, sizeof(indicators) / sizeof(UINT));
// TODO:
m_wndStatusBar.EnableDocking(CBRS_ALIGN_ANY);
EnableDocking(CBRS_ALIGN_ANY);
DockControlBar(&m_wndStatusBar);
And I still recieve an assertion that are becomes only when I add DockControlBar(&m_wndStatusBar);
.
without this is don't work too, and I think it is normal
but why it is don't work with it?
Your statusBar is created twice. Second time without any resource. Remove the second CreateEx, it should work without any problem.