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 Tech Support » Stacking Tabs? Collapse All
Subject Author Date
Brett Cook Jan 3, 2007 - 3:49 PM

Happy New Year Tech Support,

I would like to ask you about stackable tabs (if that is the right nomenclature). When I have many CExtControlBars stacked into a single bar, the tabs get too small to read the names of the of the different bars from the tabs.

Is there a way to start stacking the tabs, ala property pages, once they reach some minimum size?

Thanks,
-Brett

Technical Support Jan 5, 2007 - 9:48 AM

The tabbed bar group is an instance of the CExtDynTabControlBar class (or CExtDynamicTabbedControlBar if you are using dynamic control bars controlled by the CExtDynamicBarSite class). What you can do is to change the style of the tab strip window (the CExtDynTabWnd class) in a CExtDynTabControlBar-derived class.

1) Handle the CExtControlBar::g_nMsgCreateTabbedBar registered windows message in your main frame window:

class C_YOUR_DynTabControlBar : public CExtDynTabControlBar
{
    . . .
};
 
ON_REGISTERED_MESSAGE( CExtControlBar::g_nMsgCreateTabbedBar, OnMsgCreateTabbedBar )
 
LRESULT CMainFrame::OnMsgCreateTabbedBar( WPARAM wParam, LPARAM lParam )
{
    lParam;
    CExtDynTabControlBar ** ppBar = (CExtDynTabControlBar **)wParam;
    (*ppBar) = new C_YOUR_DynTabControlBar;
    return 0L;
}
2) In the C_YOUR_DynTabControlBar class, handle the WM_CREATE message, copy the contents of the CExtDynTabControlBar::OnCreate() method and paste it into this handler and change the styles of the m_wndTabSwitcher tab window. You should remove __ETWS_EQUAL_WIDTHS and optionally add __ETWS_AUTOHIDE_SCROLL. You can find description of these and other tab styles in the documentation.

Your code may look like as follows:
int C_YOUR_DynTabControlBar::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
    if(CExtDynTabControlBar::OnCreate(lpCreateStruct) == -1 )
    {
        ASSERT( FALSE );
        return -1;
    }

    ASSERT( m_pWndDynDocker != NULL );
    ASSERT_KINDOF( CExtDockDynTabBar, m_pWndDynDocker );
    ASSERT( m_pWndDynDocker->GetSafeHwnd() != NULL );
    ASSERT( ::IsWindow(m_pWndDynDocker->GetSafeHwnd()) );

    CRect rcTabSwitcher;
    GetClientRect( &rcTabSwitcher );
    if( rcTabSwitcher.right <= rcTabSwitcher.left )
        rcTabSwitcher.right = rcTabSwitcher.left + 10;
    rcTabSwitcher.top =
        rcTabSwitcher.bottom
        - 2
        - __EXTTAB_BTN_MIN_DY
        ;

    DWORD dwETWS = __ETWS_AUTOHIDE_SCROLL;
    if( CExtControlBar::g_bTabsAtTop )
        dwETWS |= __ETWS_ORIENT_TOP; 
    else
        dwETWS |= __ETWS_ORIENT_BOTTOM; 
    if( ! m_wndTabSwitcher.Create(
            this,
            rcTabSwitcher,
            UINT( IDC_STATIC ),
            WS_CHILD | WS_VISIBLE
                //| WS_CLIPSIBLINGS | WS_CLIPCHILDREN
                ,
            dwETWS
            )
        )
    {
        ASSERT( FALSE );
        return -1;
    }

    return 0;
}
We wish you a Happy New Year too, Brett.