Solved

ToolBar´s position

Posted on 2003-12-04
2
240 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

696 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