Instead of creating two panes,one for toolbar and other for client window, we can achieve the same goad by creating a single pane,creating a view in it, then creating a new view eg CScrollView as child of the first view and moving it to a position like CPoint(0,50).
If you request, I can send you the source
Using a real CToolbar (and not a CFormView derived class)
Posted by Legacy
on 05/15/2002 12:00am
Originally posted by:
In fact, using the same technique described here, you can add a toolbar to a split window (and you don't need to design a new dialog and create a new class).
Everyone knows how to add a CFrameWnd-derived window in a pane. What is less known is that you can add any kind of windows (CWnd and all its derived classes) in a pane. This behavior is used in this article to add a CSplitterWnd in a pane. And I used it again to add a CToolbar in place of the CFormView.
I had difficulties making what is explained in the article work. That's why I will start by a small explanation.
The first part of the article about the custom splitter window is not important! For the code you can use a standard splitter. This CSmartSplitterWnd changes the appearance of the splitter and makes it non-sizeable.
You can then create a new dialog resource (use IDD_FORMVIEW) representing your toolbar and create a class derived from CFormView based on this template.
Then you need to have 2 splitters in your CMainFrame (edit MainFrm.h):
* the main one which is usually a standard splitter that is declared as "CSplitterWnd m_parentSplitter;"
* the one we will use to create our "toolbar" which is declared as "CSmartSplitterWnd m_barSplitter;"
You can then add the function "OnCreateClient" in CMainFrame, to create the splitters and the associated views. Here is an example of such a function:
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
m_parentSplitter.CreateStatic( this, 2, 1 );
m_parentSplitter.CreateView( 1, 0, RUNTIME_CLASS( CBottomView ), CSize( 0, 0 ), pContext );
I want to know the particular about the follow member
m_cxSplitter=30; // put your own values here, to make the splitter fit your needs