Solved

Dock ToolBar.

Posted on 2004-04-30
4
660 Views
Last Modified: 2013-11-20
How do I dock 2 toolbars and align them horizontally. I tried it but one of the tool bar is always shifted down to the second line.

Thanks.
0
Comment
Question by:pcssecure
  • 3
4 Comments
 
LVL 23

Accepted Solution

by:
Roshan Davis earned 500 total points
ID: 10958627
Use 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);
}



And call this function from "CMainFrame::OnCreate", like this
DockControlBarLeftOf(&m_firstToolBar,&m_secondToolBar);

Good Luck
0
 
LVL 23

Expert Comment

by:Roshan Davis
ID: 10984938
Hope your problem has solved..
:)
0
 
LVL 23

Expert Comment

by:Roshan Davis
ID: 10995317
Is this code working?

Waiting for your reply
Rosh :)
0
 

Author Comment

by:pcssecure
ID: 11001414
Yes it works.
Thanks a lot. Sorry I forgot about this.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
repeatEnd java challenge 42 85
How to know only "File created" with EventLog 3 35
Best tools for Backup and restore of Wordpress site 6 58
NotAlone Challenge 20 88
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.

762 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