dcsimg

Sizing TabControlBar

WEBINAR:
On-Demand

Desktop-as-a-Service Designed for Any Cloud ? Nutanix Frame


Download Source Code and Example


This article extends the article "Resizable Docking Window 2" by Cristi Posea.

Features

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));

Last updated: 14 May 1998



Comments

  • There are no comments yet. Be the first to comment!

  • You must have javascript enabled in order to post comments.

Leave a Comment
  • Your email address will not be published. All fields are required.

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date