Click here to Skip to main content
Licence 
First Posted 7 Feb 2000
Views 278,016
Bookmarked 85 times

Sizing TabControlBar

By | 7 Feb 2000 | Article
Creates a dockable and resizable control bar.
  • Download demo project - 46 Kb
  • Sample Image - Sizing_Tabctl.jpg

    This article extends the article CSizingControlBar - a resizable control bar by Cristi Posea.
    Webmaster's note: the CSizingControlBar class used in this code is an earlier version; follow the link above for the latest one.

    Features

    The Control bar like in DevStudio, which has TabControls with different Views (like TreeViews) and it can be docked and resized.

    Instructions

    Add the following class to your project:

    • CSizingControlBar
    • CSizingTabCtrlBar

    Add a member variable to CMainFrame (in mainfrm.h):

    CSizingTabCtrlBar m_wndSTCBar;
    

    Create the bar in CMainFrame::OnCreate(). Then set bar styles, enable it to dock... like any control bar. Be sure to add IDW_PROP_BAR to the "resource.h" and to add the bitmap IDB_TABIMAGES to your resources.

    // SizingControlBar
    m_wndSTCBar.Create(this, CSize(200, 1), IDW_PROP_BAR);
    m_wndSTCBar.SetBarStyle(m_wndToolBar.GetBarStyle() |
    	CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
    m_wndSTCBar.EnableDocking(CBRS_ALIGN_ANY);
    DockControlBar(&m_wndSTCBar, AFX_IDW_DOCKBAR_LEFT);
    
    m_wndSTCBar.AddView("Database", RUNTIME_CLASS(CClassView));
    m_wndSTCBar.AddView("Files", RUNTIME_CLASS(CFileView));
    

    As you can see, the different views are added by calling

    m_wndSTCBar.AddView("Files", RUNTIME_CLASS(CFileView));
    

    Thats the only thing you have to do, to add a view!

    Override CMainFrame::RecalcLayout().
    Note: use the base framewnd class member function, ie if you have an SDI application replace CMDIFrameWnd with CFrameWnd below.

    void CMainFrame::RecalcLayout(BOOL bNotify) 
    {
    	CMDIFrameWnd::RecalcLayout(bNotify);
    	CMDIFrameWnd::RecalcLayout(bNotify);
    }
    

    To call a view from the Mainframe:

    CFileView* pView = (CFileView*)
    	m_wndSTCBar.GetView(RUNTIME_CLASS(CFileView));
    pView->UpdateView();	// or do anything else
    m_wndSTCBar.SetActiveView(RUNTIME_CLASS(CFileView));
    

    License

    This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

    A list of licenses authors might use can be found here

    About the Author

    Dirk Clemens



    Germany Germany

    Member



    Sign Up to vote   Poor Excellent
    Add a reason or comment to your vote: x
    Votes of 3 or less require a comment

    Comments and Discussions

     
    You must Sign In to use this message board. (secure sign-in)
     
    Search this forum  
     FAQ
        Noise  Layout  Per page   
      Refresh
    QuestionMainframe events gets disabled PinmemberD L Deepthi0:01 26 Apr '07  
    GeneralCode not maintained anymore PinmemberDirk Clemens5:41 25 Jan '05  
    GeneralDamm! Not Working Pinmemberdreucker_coder16:34 3 Jan '05  
    GeneralThe shorter way, please help fix Pinmemberpank00711:28 27 Nov '04  
    GeneralWinFrm2.cpp and bardock errors PinmemberFurries5:46 24 Nov '04  
    GeneralNot work with either vs6 Pinmemberpank00711:52 21 Nov '04  
    GeneralCommand message handling in views inside this bar Pinmemberatali6:18 21 Oct '04  
    GeneralRedraw the bar after adding a view Pinmemberatali6:11 21 Oct '04  
    GeneralSupport for top and multiline taps Pinmemberjaime_olivares14:33 8 Jul '04  
    GeneralBetter version Pinmemberjaime_olivares14:52 8 Jul '04  
    QuestionBugs? Pinmembermaydina3:51 24 Apr '04  
    GeneralProblem with CSizingTabCtrlBar by Dirk Clemens Pinmemberredsome14:43 25 Mar '04  
    GeneralProg crash by klick on X PinmemberLowFly5:04 18 Mar '04  
    GeneralMutch Better Layout Code PinmemberMOX7:28 10 Mar '04  
    GeneralRe: Mutch Better Layout Code PinmemberKybert11:47 9 Apr '04  
    GeneralRe: Mutch Better Layout Code PinsussAnonymous9:59 19 Apr '04  
    AnswerRe: Mutch Better Layout Code PinmemberThornets22:52 30 Jul '08  
    Generalissue when closing with floating bar Pinmemberavcode21:43 4 Mar '04  
    GeneralDocking - TOP , BOTTOM Pinmembersalil_ps20:39 20 Feb '04  
    GeneralProblems with Mouse Click Pinmembersalman20:04 29 Dec '03  
    Generalwheel mouse capture problem Pinmemberstevehaigh11:21 8 Nov '03  
    GeneralClosing CSizingControlBar PinsussD-MD10:48 31 Jul '03  
    GeneralRe: Closing CSizingControlBar Pinmemberxiaobin22:55 9 Aug '03  
    GeneralNot work well in VS.net 2003!! PinmemberYoyoboy2:56 31 Jul '03  
    GeneralRe: Not work well in VS.net 2003!! Pinmemberlqhwinner2:22 3 Jun '04  

    General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

    Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

    Permalink | Advertise | Privacy | Mobile
    Web02 | 2.5.120517.1 | Last Updated 8 Feb 2000
    Article Copyright 2000 by Dirk Clemens
    Everything else Copyright © CodeProject, 1999-2012
    Terms of Use
    Layout: fixed | fluid