[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Frame inside a Splitter Pane

Posted on 1998-01-08
2
Medium Priority
?
469 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 400 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 to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
In this post we will learn different types of Android Layout and some basics of an Android App.
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.
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

872 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