BitTweaker
April 29th, 2004, 09:33 PM
Please help if you can. I have 3 toolbars I'm placing in a CRebar. The problem I'm having is that the first toolbar I add always takes up any extra space in the rebar. The last two toolbars end up pushed over to the end of the window. I expected to see all the toolbars on the left side and extra space on the right.
I've been reading on properities for the Rebar and for toolbars but haven't found a solution. Every Rebar example I find only has one band, so of course doesn't have this problem.
Here's an abbreviated peek at the code:
CToolBar m_wndToolBar;
CToolBar m_MenuToolbar;
CToolBar m_GenToolbar;
CReBar m_rebar;
if (!m_rebar.Create(this, 0))
{
TRACE0("Failed to create application ReBar\n");
return -1; // fail to create
}
if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD |
WS_VISIBLE | CBRS_TOP| CBRS_GRIPPER | CBRS_TOOLTIPS |
CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
if (!m_Toolbar2.CreateEx(this, TBSTYLE_FLAT, WS_CHILD |
WS_VISIBLE | CBRS_TOP| CBRS_GRIPPER | CBRS_TOOLTIPS |
CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
!m_Toolbar2.LoadToolBar(IDR_TOOLBAR2))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
if (!m_GenToolbar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD |
WS_VISIBLE | CBRS_TOP| CBRS_GRIPPER | CBRS_TOOLTIPS |
CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
!m_GenToolbar.LoadToolBar(IDR_GEN_TOOLBAR))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
// Add the toolbars to the rebar
m_rebar.AddBar(&m_wndToolBar);
m_rebar.AddBar(&m_Toolbar2);
m_rebar.AddBar(&m_GenToolbar);
I've been reading on properities for the Rebar and for toolbars but haven't found a solution. Every Rebar example I find only has one band, so of course doesn't have this problem.
Here's an abbreviated peek at the code:
CToolBar m_wndToolBar;
CToolBar m_MenuToolbar;
CToolBar m_GenToolbar;
CReBar m_rebar;
if (!m_rebar.Create(this, 0))
{
TRACE0("Failed to create application ReBar\n");
return -1; // fail to create
}
if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD |
WS_VISIBLE | CBRS_TOP| CBRS_GRIPPER | CBRS_TOOLTIPS |
CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
!m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
if (!m_Toolbar2.CreateEx(this, TBSTYLE_FLAT, WS_CHILD |
WS_VISIBLE | CBRS_TOP| CBRS_GRIPPER | CBRS_TOOLTIPS |
CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
!m_Toolbar2.LoadToolBar(IDR_TOOLBAR2))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
if (!m_GenToolbar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD |
WS_VISIBLE | CBRS_TOP| CBRS_GRIPPER | CBRS_TOOLTIPS |
CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
!m_GenToolbar.LoadToolBar(IDR_GEN_TOOLBAR))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
// Add the toolbars to the rebar
m_rebar.AddBar(&m_wndToolBar);
m_rebar.AddBar(&m_Toolbar2);
m_rebar.AddBar(&m_GenToolbar);