2

I am writing software with MFC feature pack 2008. My application is based on old version this application. The old version was not written with feature pack. In the old version of this application, there are CToolBar and 3 CDialogBars. It looks as follow: enter image description here

In my application, I changed CToolBar to CMFCToolbar and CDialogBars to CPaneDialogs. I don't know how I can set CPaneDialogs to make the same visual effect like in the old application? How can I dock CPaneDialogs to left of CMFCToolbar?

to sum up, what I did:

1) Create CPaneDialogs this way:

    if (!m_LoadDlgBar.Create(_T("DialogBar"),this, 0,IDD_REGBAR,CBRS_TOP | CBRS_FLYBY |CBRS_GRIPPER|  WS_CLIPCHILDREN,IDD_REGBAR))
    {
       TRACE0("Failed to create dialog bar\n");
       return -1;      // fail to create
    }

2) Docking:

EnableDocking(CBRS_ALIGN_ANY);
DockPane(&m_CommBar);          // this is CMFCToolbar
DockPaneLeftOf(&m_LoadDlgBar, &m_CommBar);    
DockPaneLeftOf(&m_TCPIPDlgBar, &m_LoadDlgBar);    
DockPaneLeftOf(&m_ConnDlgBar, &m_TCPIPDlgBar);    

3) Show the Pane:

m_LoadDlgBar.ShowPane(TRUE,FALSE,FALSE);

And this is result:

enter image description here

All of CPaneDialogs are dock in the same place, on the CMFCToolbar.

Ahemski
  • 93
  • 8

1 Answers1

0

You initiate docking with DockPane, so instead of using CFrameWndEx::DockPane use CFrameWndEx::DockPaneLeftOf

PS: This article provides a little help, but saddly it just scratches the surface.

xMRi
  • 14,982
  • 3
  • 26
  • 59
  • I use DockPaneLeftOf, but it doesn't work correctly. Please see in the question, I added some information. – Ahemski Jun 16 '15 at 08:29
  • What is the error. Your code docks your CPaneDialog windows always to the left of the controlbar, and the next is again left of... If you want to get the controlbar Leftof something you have to do it. – xMRi Jun 16 '15 at 08:32
  • I don't understand. Could you write some example code to show how to do it correctly? – Ahemski Jun 16 '15 at 09:59
  • DockPaneLeftOf(&m_LoadDlgBar, &m_CommBar); Tells m_LoadDlgBar to be left of m_CommBar. You have to revert this if you want to have m_LoadDlgBar right of m_CommBar. – xMRi Jun 16 '15 at 11:20