0
votes

I need a basic on how to declare/implement and use the CTabView class for an MFC SDI. I have searched in vain for samples and reference. I assume because MFC is not the most current foundation information is hard to find on certain topics, anything about tabs in particular. How declare an create the tabbed view object? When using add/delete view in the control, is the control creating the view or adding a tab to a view that is already created. Moving and Sizing? Truly appreciate any help. Need native C++ in this app, so answers that tell me how much easier in C# with a different foundation do not help.

1

1 Answers

2
votes

Simply derive your view class from CTabView.

You can add as many tabs as you need by calling:

AddView(RUNTIME_CLASS(CMyView),_T("Tab1"));
AddView(RUNTIME_CLASS(CMyView),_T("Tab2"));
AddView(RUNTIME_CLASS(CMyView),_T("Tab3"));

You can also customize the location and other things of tab control by calling:

GetTabControl().SetLocation(CMFCBaseTabCtrl::LOCATION_BOTTOM);
GetTabControl().ModifyTabStyle(CMFCTabCtrl::STYLE_3D_ONENOTE);
GetTabControl().EnableTabDocumentsMenu(TRUE);
GetTabControl().EnableActiveTabCloseButton(TRUE);
GetTabControl().EnableTabSwap(TRUE);

from int CMyTabView::OnCreate(LPCREATESTRUCT lpCreateStruct)