I have an MDI application that creates 3 views and adds it to a CTabView derived class in the OnCreate handler like this:
AddView (RUNTIME_CLASS (CView1), _T("Simple"), 100);
This works fine. Now, I have a menu item on the CChildFrame class from which I want to add another CScrollView derived class to the TabView. Code pasted in the Code section. I get an ASSERT in the AddView function call. Please let me know how to attach a new CView derived class to the CTabView at runtime. I have attached relevant source files after renaming them as text files.
CView* pChildView = GetActiveView();
CMFCTabCtrl* pCtrl = (CMFCTabCtrl*)pChildView->GetParent();
CTabbedViewView* pView = (CTabbedViewView*)pCtrl->GetParent();
pView->AddView(RUNTIME_CLASS (CView4), _T("ScrollView"), 103); //<----error here...