Professional UI Solutions
Site Map   /  Register


Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS General Discussion » A question, regarding CExtControlBar docking mechanism Collapse All
Subject Author Date
Nathan Explosions Jun 5, 2007 - 5:59 AM


With the help of Prof-UIS I have created an MDI MFC application with the following layout:

Pray tell me, what should I do in oder to dock a new control bar, which is not shown here, to all other control bars, so it would always cover the empty space, especially when control bars are hidden / shown, replaced and resized?

The only solution I could think of was to create a method, which re-docks the new control bar when its size changes (the method is called in CMainFrame::OnSize handler). The following code is a simplified version of this method and demonstrates just the basic idea, which lies behind it:

void reDock()
    RECT cr;
    GetClientRect(&cr); //getting MainFrame client rectangle

    int CX = cr.right - cr.left;
    int CY = cr.bottom -;

    m_wndLeftBar1.GetClientRect(&cr); //getting Left Control Bar 1 client rectangle
    CX -= (cr.right - cr.left);

    m_wndBottomBar.GetClientRect(&cr); //getting Bottom Control Bar client rectangle
    CY -= (cr.bottom -;

    m_wndNewBar.SetInitDesiredSizeHorizontal( CSize(CX, CY) );
    m_wndNewBar.SetInitDesiredSizeVertical( CSize(CX, CY) );
    m_wndNewBar.DockControlBar( AFX_IDW_DOCKBAR_RIGHT, true, this, false);


Such a method is very unhandy, because I am using control bars, which can be resized, replaced and docked anywhere, so the code becomes pretty complex...

Also, changing initial size of the New Bar for horizontal / vertical state in some cases affects manual re-docking and resizing of control bars, and also this method doesn’t work well with the profile loading.

Please tell me, if there is a better way to solve this problem...

Thank you very much for your attention.

Nathan Explosions Jun 6, 2007 - 11:01 PM

Thanks for the advice, that’s what I’ve been looking for.

Technical Support Jun 6, 2007 - 10:35 AM

You should not dock any control bar to occupy free rest space of the frame window. You should use dynamic control bars instead. Each dynamic control bar can be switched into the document mode where it covers the rest space of the frame window. You can see how it works in the MDI_DynamicBars and SDI_DynamicBars samples that come with Prof-UIS.