Professional UI Solutions
Site Map   /  Register
 
 

Forum

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 » Dynamic Bars Collapse All
Subject Author Date
The Obliterator Feb 16, 2006 - 10:53 AM

Just downloaded a trial - like the look of vs2005 style docking bars.


Would it be possible make the title area (and buttons) of the docking bars appear vertically down the side of the docked bar rather than horizontally across the top?


Looking through the header files I suspect overriding CExtDockBar::OnNcCalcSize and CExtDockBar::OnNcPaint might be a way of achieving this? But can’t find the actual implementation of these functions so I’m not sure.


Or would the workload involved be very complex?


 

Technical Support Feb 16, 2006 - 11:32 AM

Just set CExtControlBar::m_bGripperStaticallyAtTop to false for the resizable bar window with a right-oriented caption if it is docked in a horizontal row. You can also use a CExtControlBar-derived class like as follows if you want permanently change the gripper orientation:

class CMyBar: public CExtControlBar
{
public:
    virtual bool IsBarWithGripper(
        bool * pbGripperAtTop = NULL,
        bool * pbTextOnGripper = NULL
        ) const
    {
        if( ! CExtControlBar::IsBarWithGripper( pbGripperAtTop, pbTextOnGripper ) )
            return false;
        if( pbGripperAtTop != NULL )
            (*pbGripperAtTop) = false;
        return true;
    }
}
It is also possible to turn on the contract/expand button like in bars of Visual C++ 6.0 IDE. Just override the OnNcAreaButtonsReinitialize() virtual method in a CExtControlBar-derived class like this:
 
    virtual void OnNcAreaButtonsReinitialize()
    {
        ASSERT_VALID( this );
INT nCountOfNcButtons = NcButtons_GetCount();
        if( nCountOfNcButtons > 0 )
            return;
        NcButtons_Add( new CExtBarNcAreaButtonClose( this ) );
#if (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
        NcButtons_Add( new CExtBarNcAreaButtonAutoHide( this ) );
#endif // (!defined __EXT_MFC_NO_TAB_CONTROLBARS)
        NcButtons_Add( new CExtBarNcAreaButtonExpand( this ) );
        NcButtons_Add( new CExtBarNcAreaButtonMenu( this ) );
    }


The Obliterator Feb 17, 2006 - 8:34 AM

Thanks for quick response.


Very impressed! The overridden class worked a treat. But it doesn’t render the title text vertically in the caption area. I guess this could be added if had the full source?


Couldn’t get the additional VC6 style expand buttons to appear. Not sure what I’m doing wrong but it only displays the close and auto hide buttons. Maybe its because I’m modding the MDI_DynamicBars sample.


Also is there a function to automatically equalise the size of each window. For example, if the user has 3 windows docked one on top of another it would be nice to be able to make each window exactly one third in height.

Technical Support Feb 18, 2006 - 3:28 AM

The text should be rendered vertically in the caption. If it is not the case, then we can review your sample application.

The way to show expand buttons we described in the previous post works only for the simple resizable control bars (the CExtControlBar class). In case of dynamic control bars (CExtDynamicControlBar), you need to declare a similar CExtDynamicControlBar-derived class which has the DECLARE_DYNCREATE/IMPLEMENT_DYNCREATE implementation in the class declaration/implementation. This will let you use a pointer to the runtime class (MFC’s CRunTimeClass object) of the defined custom dynamic resizable control bar class when invoking CExtDynamicBarSite::BarAlloc() inside CMainFrame::OnCreate(). We can help you modify your version of the MDI_DynamicBars sample application to get what you really need.

It is possible to dock three control bars (simple or dynamic) into a single column so each control bar takes approximately one third of the column height. This can be done with the following method of the CExtControlBar class:

// dock control bar relative to other control bar using
// space percent specification (extended version)
virtual bool DockControlBarLTRB(
    int nPercentToOccupy, // greater then zero and less then one hundred
    CExtControlBar * pBarTarget,
    UINT nDockBarID = AFX_IDW_DOCKBAR_BOTTOM,
    bool bRecalcLayout = true
    );
Let’s assume we have three bars specified with m_wndBar1, m_wndBar2, and m_wndBar3 and m_wndBar1 is already docked somewhere. First of all, we need to dock m_wndBar2 so it will take 66 % of the space of m_wndBar1 at bottom:
// "this" is a pointer to the CMainFrame window
m_wndBar2.DockControlBarLTRB( 66, &m_wndBar1, this, AFX_IDW_DOCKBAR_BOTTOM );
The second step is to dock m_wndBar3 with m_wndBar2. Make it take 50 % of m_wndBar2 at bottom:
// "this" is a pointer to the CMainFrame window
m_wndBar3.DockControlBarLTRB( 50, &m_wndBar2, this, AFX_IDW_DOCKBAR_BOTTOM );
This is also described in the following FAQ:
How to dock several control bars into one row so that they share its space in certain proportions?