Solved

Frame inside a Splitter Pane

Posted on 1998-01-08
2
420 Views
Last Modified: 2013-11-20
Hi there,

I've got an application that is broken into three views. A tree to the left, and a vertically split area to the right. What I want to do is "sometimes" have one of the views on the right split again.

I can change the view of the pane, but the splitter is the problem.

The way I would see to do this would have to be to put a FrameWnd inside the appropriate Splitterwnd pane. Therein lies the problem.

How do I do this? ... or can I place a splittedwnd in a view class.

Thanks for your help...
0
Comment
Question by:pdeb
2 Comments
 
LVL 1

Accepted Solution

by:
WBerthin earned 100 total points
ID: 1313662
Probably the most convenient way to do this is to set up 3 static splitter windows by splitting the second pane. You can
resize the splitter windows programatically and thus move the
third view to the far right when it is not in use. All that
would be visible is a narrow bar.

You can also put Frame window in split windows. This works fine
if you want to put other things in the split windows such as
Control Bars of various types. Since you can split panes it is
not really necessary to put a frame into a split window just
to split the window again it again.

If you want you can split windows dynamically (as opposed to
statically). You can create a dynamic splitter window that
displays diffenent types of view in different panes. Do this by
deriving a class from CSplitterWnd, overriding CreateView, and
calling CSplitterWnd::CreateView with a CRuntimeClass pointer to
the new view. For example if you wanted to dynamically override
the view in row 0, column 1 without affecting the view in row 0
column 0 you could write:

BOOL CDynamicSplitterWnd::CreateView(
    int row, int col, CRuntimeClass* pViewClass,
    sizeInit, pContext )
{
    if( col == 1 )
    {
        return CSplitterWnd::CreateView(row, col,
           RUNTIME_CLASS(CMyNewView), sizeInit, pContext );
    }
    return CSplitterWnd::CreateView(row, col,
       pViewClass, sizeInit, pContext );
}

You cannot of course split a CView, but if you can change the
view (I assume meaning window area) to a pane you can then split
the pane dynamically as above.

SAMPLE CODE
As a futher example of working with splitters, the following
code is taken from a program that creates 3 static splitter
windows, and puts a CFrameWnd in each:

BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
      // Create a static splitter with 1 row, 2 columns
      if( !m_FormatSplitter.CreateStatic(
            this,                  // CWnd* pParentWnd
            1,                  // int nRows
            2,                  // int nColumns
            WS_CHILD | WS_VISIBLE,      // DWORD dwStyle
            AFX_IDW_PANE_FIRST ) )      // UINT nID      
            return FALSE;

      // Add the second splitter frame in column 1
      // which is a nested splitter with 2 columns
      if( !m_DatabaseSplitter.CreateStatic(
            &m_FormatSplitter,      // CWnd* pParentWnd - our
                                        // parent window is the
                                        // first splitter
            1,                    // int nRows
            2,                  // int nColumns
            WS_CHILD | WS_VISIBLE ,      // DWORD dwStyle
            m_FormatSplitter.IdFromRowCol(0, 0) ) )
                       // UINT nID - the new splitter is in the
                       // 1st row and 1st column of the first
                       // splitter
            return FALSE;

      if( !m_FormatSplitter.CreateView(
            0,               // int nRow
            1,            // int nColumn
            RUNTIME_CLASS(CTemplateFrm),
                         // CRuntimeClass* pViewClass
            CSize( 0 , 0 ),       // Size sizeInit
            pContext) )      // CCreateContext* pContext
            return FALSE;

      // Set the Database pane in the left frame
      if( !m_DatabaseSplitter.CreateView(
            0,       // int nRow
            0,      // int nColumn
            RUNTIME_CLASS(CMainTreeFrm),
                      // CRuntimeClass* pViewClass
            CSize( m_nDatabaseWidth , 0 ),// CSize sizeInit
            pContext ) )      // CCreateContext* pContext
            return FALSE;

      // Set the search result pane in the center frame
      if( !m_DatabaseSplitter.CreateView(
            0,      // int nRow
            1,      // int nColumn                              RUNTIME_CLASS(CSearchResultFrm),
                       // CRuntimeClass* pViewClass
            CSize( 0 , 0 ),       // CSize sizeInit
            pContext) )  // CCreateContext* pContext
            return FALSE;

      // Set the column width of the database pane
      m_FormatSplitter.SetColumnInfo(
                0, m_nSearchResultWidth,0);
}

0
 

Author Comment

by:pdeb
ID: 1313663
I didn't want to have three splitters in the main frame because I have 4 views that want to go in that pane, and only one wants the splitter.

The best way I found was to place a frame in pane and then split that - so it would only appear in that view.

Your answer was good and comprehensive.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
if loop error 4 77
no14 challenge 14 57
wait notify demo infinite loop 3 81
SQUD PROXY SERVER, UNIX, SLL/HTTPS 5 50
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now