Problem
How can I use a CGXTabWnd in a static splitter window?
Cause
Action
Here are the steps necessary for doing this:
When you create the windows, you can create a tab window and embed the worksheets into it. The following example shows you how to display a static splitter window with two panes. The panes are CGXTabWnd, each having several worksheets.
Example:
class CScrltabsSplitMDIChildWnd : public CMDIChildWnd { |
|||
DECLARE_DYNCREATE(CScrltabsSplitMDIChildWnd) | |||
protected: | |||
// protected constructor used by dynamic creation CScrltabsSplitMDIChildWnd( ); |
|||
public: | |||
// Attributes CSplitterWnd m_wndSplitter; CGXTabWnd* m_pTabWnd1; CGXTabWnd* m_pTabWnd2; // Operations |
|||
protected: | |||
// Implementation virtual ~CScrltabsSplitMDIChildWnd( ); // Generated message map functions DECLARE_MESSAGE_MAP( ) |
|||
}; BOOL CScrltabsSplitMDIChildWnd::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) |
|||
CScrltabsApp* pApp = (CScrltabsApp*) AfxGetApp( );
// Specify the runtime class for the // Creates the TabWnd object |
|||
TRACE(Failed to create third pane ); return FALSE; |
|||
}
m_pTabWnd1 = (CGXTabWnd*) m_wndSplitter.GetPane(0, 0); // Creates the View2 worksheet in the tab window m_pTabWnd1->CreateView(RUNTIME_CLASS(CScrltabsView), View 2, pContext); // Creates the TabWnd object |
|||
TRACE(Failed to create third pane ); return FALSE; |
|||
}
m_pTabWnd2 = (CGXTabWnd*) m_wndSplitter.GetPane(1, 0); // Creates the View1, View2 and View3 worksheets m_pTabWnd2->CreateView(RUNTIME_CLASS(CScrltabsView), View 2, pContext); m_pTabWnd2->CreateView(RUNTIME_CLASS(CScrltabsView), View 3, pContext); return TRUE; |
|||
}
void CScrltabsSplitMDIChildWnd::PostNcDestroy() |
|||
// Tab windows must be deleted here delete m_pTabWnd1; m_pTabWnd1 = NULL; delete m_pTabWnd2; m_pTabWnd2 = NULL; CMDIChildWnd::PostNcDestroy(); |
|||
} |