Solved

ToolBar´s position

Posted on 2003-12-04
2
235 Views
Last Modified: 2013-11-20
I have 4 toolbars in my application. On the CMainFrame::OnCreate method I wrote this code to each
one to create them:
if (!m_wndCompileBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | BRS_SIZE_DYNAMIC) ||!m_wndCompileBar.LoadToolBar(IDR_COMPILAR))
{
   TRACE0("Failed to create compilebar\n");
   return -1;      // fail to create
}

the problem is that they appear one behind the other and i want them one beside the other at the same level.
I modified the flags but i couldn´t show them how i want.
Please help me and excuse me for my poor english.  
 
0
Comment
Question by:martin11_ar
2 Comments
 

Expert Comment

by:JeffT
ID: 9876789
Did you try calling MoveWindow or SetWindowPos after you create the toolbars?
0
 
LVL 23

Accepted Solution

by:
Roshan Davis earned 125 total points
ID: 9879930
Add this function

void CMainFrame::DockControlBarLeftOf(CToolBar* Bar,CToolBar* LeftOf)
{
      CRect rect;
      DWORD dw;
      UINT n;

      // get MFC to adjust the dimensions of all docked ToolBars
      // so that GetWindowRect will be accurate
      RecalcLayout();
      LeftOf->GetWindowRect(&rect);
      rect.OffsetRect(1,0);
      dw=LeftOf->GetBarStyle();
      n = 0;
      n = (dw&CBRS_ALIGN_TOP) ? AFX_IDW_DOCKBAR_TOP : n;
      n = (dw&CBRS_ALIGN_BOTTOM && n==0) ? AFX_IDW_DOCKBAR_BOTTOM : n;
      n = (dw&CBRS_ALIGN_LEFT && n==0) ? AFX_IDW_DOCKBAR_LEFT : n;
      n = (dw&CBRS_ALIGN_RIGHT && n==0) ? AFX_IDW_DOCKBAR_RIGHT : n;

      // When we take the default parameters on rect, DockControlBar will dock
      // each Toolbar on a seperate line.  By calculating a rectangle, we in effect
      // are simulating a Toolbar being dragged to that location and docked.
      DockControlBar(Bar,n,&rect);
}

Good Luck
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now