CToolbar

Hi

I have a property page which displays two toolbars

I need to position these in certain places, see code below

m_toolBar positions fine, but m_toolBar2 stays in the top left corner

Can anyone help me place this in the correct location

Simon

BOOL CMessage::OnInitDialog()
{
CPropertyPage::OnInitDialog();

m_toolBar2.CreateEx(this, TBSTYLE_FLAT );
if (!m_toolBar2.LoadToolBar(IDR_TOOLBAR2))
AfxMessageBox("failed");

DWORD dwExStyle = TBSTYLE_EX_DRAWDDARROWS;
m_toolBar2.GetToolBarCtrl().SendMessage(TB_SETEXTENDEDSTYLE, 0, (LPARAM)dwExStyle);

DWORD dwStyle = m_toolBar2.GetButtonStyle(m_toolBar2.CommandToIndex(ID_TBPRIORITY));
dwStyle |= TBSTYLE_DROPDOWN;
m_toolBar2.SetButtonStyle(m_toolBar2.CommandToIndex(ID_TBPRIORITY), dwStyle);

m_toolBar2.MoveWindow( 175, 125,450, 230, 1 );


if(!m_toolBar.CreateEx(this, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_TOOLTIPS |CBRS_FLYBY | TBBS_BUTTON) || !m_toolBar.LoadToolBar(IDR_TOOLBAR1))
AfxMessageBox("failed");
m_toolBar.SetButtonInfo(m_toolBar.CommandToIndex(ID_FILE_SAVE)+1,ID_SEPARATOR,TBBS_SEPARATOR,5);
m_toolBar.SetButtonInfo(m_toolBar.CommandToIndex(ID_EDIT_DELETE)+1,ID_SEPARATOR,TBBS_SEPARATOR,5);
m_toolBar.SetButtonInfo(m_toolBar.CommandToIndex(ID_EDIT_UNDO)+1,ID_SEPARATOR,TBBS_SEPARATOR,5);
m_toolBar.SetButtonInfo(m_toolBar.CommandToIndex(ID_APP_ABOUT)+1,ID_SEPARATOR,TBBS_SEPARATOR,5);
m_toolBar.SetButtonInfo(m_toolBar.CommandToIndex(ID_COLOUR)+1,ID_SEPARATOR,TBBS_SEPARATOR,5);
m_toolBar.SetButtonStyle(m_toolBar.CommandToIndex(ID_BOLD),TBBS_CHECKBOX);
m_toolBar.SetButtonStyle(m_toolBar.CommandToIndex(ID_UNDERLINE),TBBS_CHECKBOX);
m_toolBar.SetButtonStyle(m_toolBar.CommandToIndex(ID_ITALIC),TBBS_CHECKBOX);
m_toolBar.SetButtonStyle(m_toolBar.CommandToIndex(ID_PARAGRAPH_LEFT),TBBS_CHECKGROUP);
m_toolBar.SetButtonStyle(m_toolBar.CommandToIndex(ID_PARAGRAPH_CENTER),TBBS_CHECKGROUP);
m_toolBar.SetButtonStyle(m_toolBar.CommandToIndex(ID_PARAGRAPH_RIGHT),TBBS_CHECKGROUP);


m_toolBar.SetButtonStyle(m_toolBar.CommandToIndex(ID_PARAGRAPH_BULLETED),TBBS_CHECKBOX);


RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST,0);
m_toolBar.MoveWindow( 230, 150,450, 30, 1 );

return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
Topic archived. No new replies allowed.