Click here to Skip to main content
Click here to Skip to main content
Go to top

Sizing TabControlBar

, 7 Feb 2000
Rate this:
Please Sign up or sign in to vote.
Creates a dockable and resizable control bar.
  • Download demo project - 46 Kb
  • Sample Image - Sizing_Tabctl.jpg

    <!-- Article Starts -->

    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

    Share

    About the Author

    Dirk Clemens

    Germany Germany
    No Biography provided

    Comments and Discussions

     
    GeneralViews update problem solved PinmemberFretBoardKnowledge18-Dec-02 14:15 
    GeneralRe: Views update problem solved PinmemberPhilip Patrick31-Mar-03 8:15 
    GeneralRe: Views update problem solved Pinmemberandyvinc24-Apr-04 4:35 
    Questionhow to merge two floating dialogbar into one floating tabbed dialogbar? PinmemberYU_Matrix27-Nov-02 20:59 
    Questionhelp, tell me what is IDW_PROP_BAR ?? Pinmemberhongky17-Nov-02 19:03 
    AnswerRe: help, tell me what is IDW_PROP_BAR ?? PinmemberWREY21-Jun-03 13:53 
    GeneralBugfix: Defect border while enlarging PinsussTomer Shalev12-Aug-02 21:06 
    GeneralIt does Not work...Help me.... PinsussParkSK30-Jul-02 22:39 
    GeneralRe: It does Not work...Help me.... PinmemberJawid18-Sep-02 12:07 
    GeneralThank you very much..It works well !! PinmemberDevPark5-Nov-03 18:01 
    GeneralRe: It does Not work...Help me.... Pinmembergremyus11-Feb-04 7:57 
    GeneralRe: It does Not work...Help me.... Pinmembersirius yang20-Oct-04 18:14 
    Questionwhy onec i created it ,my listview will not work? Pinmemberxsword6-May-02 0:36 
    QuestionRedrawing the client area? PinmemberAnonymous13-Apr-02 6:37 
    AnswerRe: Redrawing the client area? PinmemberAnonymous16-May-02 6:04 
    GeneralRe: Redrawing the client area? PinmemberDanPetitt17-Feb-03 10:56 
    GeneralRe: Redrawing the client area? PinmemberDanPetitt17-Feb-03 11:07 
    GeneralRe: Redrawing the client area? PinmemberuTMan12-Nov-03 8:28 
    GeneralI can't run it. It dumped failed info when creat CSizingControlBar PinmemberCrob28-Feb-02 15:15 
    GeneralRe: I can't run it. It dumped failed info when creat CSizingControlBar PinmemberAnonymous6-Mar-02 12:41 
    GeneralSizing Tab Control Bar Pinmembercarena10-Jan-02 22:33 
    GeneralRe: Sizing Tab Control Bar PinmemberAnonymous22-May-02 7:19 
    GeneralRe: Sizing Tab Control Bar Pinmemberzoocmic2-Jul-02 21:50 
    GeneralRe: Sizing Tab Control Bar (lost control) PinmemberEugene Pankov24-Jul-02 3:55 
    Generalslow redraw when docked under NT Pinmemberthotho26-Nov-01 0:12 
    GeneralRemove a view PinmemberFlavio Vanderson23-Nov-01 3:16 
    GeneralCanging Labeltext of Tabs while Resizing PinmemberJoerg Tiedemann13-Nov-01 22:45 
    GeneralProblem by closing ControlBar PinmemberHolger Bach25-Oct-01 21:28 
    GeneralRe: Problem by closing ControlBar PinmemberNeno28-Oct-01 23:17 
    GeneralRe: Problem by closing ControlBar PinmemberNenad28-Oct-01 23:28 
    QuestionStart with no default document ?? Pinmember北極熊23-Oct-01 20:26 
    GeneralProblem with new ver CSizingControlBar and AddView() PinmemberNeno19-Oct-01 3:48 
    QuestionX-button problem? PinmemberNeno18-Oct-01 22:22 
    QuestionHow to create workspace Window? PinmemberRadhakrishnan R.24-Sep-01 23:52 
    GeneralAdd a ListView PinmemberFranzKlein17-Jun-01 23:27 
    GeneralRe: Add a ListView PinmemberPark KeunHyun16-Sep-01 17:29 
    GeneralDagbog PinmemberAnonymous16-Mar-01 22:16 
    GeneralProblems with Visual Studio 6 PinsussCraig Spry12-Oct-00 13:00 
    GeneralRe: Problems with Visual Studio 6 PinsussRich McDonald13-Oct-00 13:23 
    GeneralRe: Problems with Visual Studio 6 PinsussSerginho15-Jul-02 21:22 
    Generalno ENTER, no ESCAPE Messages in TreeView PinsussThomas Barthel28-Aug-00 10:05 
    GeneralRe: no ENTER, no ESCAPE Messages in TreeView PinmemberSureshBalivada31-Jul-01 9:56 
    GeneralProblem in AddView(....) PinsussSanjeev6-Aug-00 18:50 
    GeneralRe: Problem in AddView(....) PinsussSanjay Bora15-Aug-00 16:00 
    QuestionHow can we do this............... PinsussSanjeev2-Aug-00 21:22 
    GeneralSorry, no more maintainance! PinsussDirk Clemens25-Jul-00 1:58 
    GeneralUsing sample with CListView derived view .. PinsussDave Stanley24-Jul-00 13:59 
    GeneralRe: Using sample with CListView derived view .. PinmemberAnonymous1-May-01 11:47 
    QuestionHow can i do this... Pinsusswebguy11-Jul-00 11:51 
    Generalproblem --> Z order PinsussDC13-Mar-00 2:36 

    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.

    | Advertise | Privacy | Mobile
    Web03 | 2.8.140916.1 | Last Updated 8 Feb 2000
    Article Copyright 2000 by Dirk Clemens
    Everything else Copyright © CodeProject, 1999-2014
    Terms of Service
    Layout: fixed | fluid