[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

How to make two toolbars dock in a row

Posted on 1999-07-12
2
Medium Priority
?
371 Views
Last Modified: 2013-11-20
Please have a look at this code and tell me how to make the two toolbars appear one after the other instead of one below the other. The two toolbars are m_wndToolBar and m_sortToolbar :-

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_sortToolbar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||!m_sortToolbar.LoadToolBar(IDR_SORT_TOOLBAR))
      {
            TRACE0("Failed to create sort toolbar\n");
            return -1;      // fail to create
      }


      m_wndToolBar.EnableDocking(CBRS_ALIGN_TOP);
      m_sortToolbar.EnableDocking(CBRS_ALIGN_TOP);
      EnableDocking(CBRS_ALIGN_TOP);

      DockControlBar(&m_wndToolBar);
      DockControlBar(&m_sortToolbar);

***********************************************************
0
Comment
Question by:rupak_khurana
2 Comments
 
LVL 23

Accepted Solution

by:
naveenkohli earned 40 total points
ID: 1309696
Here is the sample code for doing that. You calculate the rectangle of docking frame. Offset the rectangle by 1 unit. And then in call to DockCintrolBAr specify the side to which you want to dock the new bar with respect to existing one.

You can make use of this code and write a helper function to do this job.

********************************

CRect rect;
CToolBar *pExistingToolBar, *pNewToolBar;

CFrameWnd *pFrame = pExistingToolBar->GetDockingFRame ();

pFrame->ReCalcLayout ();

pExistingToolBar->GetWindowRect (&rect);

rect.Offset (1,1);

pFrame->DockControlBar (pNewToolBar, nToolBarID, &rect);



0
 

Author Comment

by:rupak_khurana
ID: 1309697
Thanks Naveen.. It really worked.... !!!!
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

Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
The video provides a quick and easy steps to migrate MBOX file to well known Outlook PST and Office 365. Besides this, it also supports and migrates more than 20 email clients of MBOX which include AppleMail, Opera, Thunderbird and SeaMonkey effortl…
Suggested Courses

591 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