?
Solved

Changing view in a static splitterView

Posted on 2000-02-22
7
Medium Priority
?
701 Views
Last Modified: 2013-11-20
I have  a 3 way splitter window with this configuration.

           | View 2
 View1  |---------
           | View 3

I create it with CreateStatic().

Thanks to an action on view1, I want to change view2 (from ClistView to CFormView, for example).
Unfortunatly 'from MSDN CSplitterWnd::CreateView ' :

'All panes of a static splitter window must be created before the framework displays the splitter.'

So how can I change it dynamicly?

Thanks for help in advance
0
Comment
Question by:rgrand
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 3

Expert Comment

by:V_Bapat
ID: 2545887
Check out Q196832 in Microsoft knowledge base http://support.microsoft.com/support/kb/articles/Q196/8/32.ASP


This article demonstrates how to use a static splitter window in a traditional SDI document-view architecture. The article shows how to design an application that can switch between a single view and a splitter window that can embed as many panes as necessary.

You can easily expand the code to support static splitter windows with different numbers of panes, depending on some run-time conditions.

0
 
LVL 3

Expert Comment

by:V_Bapat
ID: 2545909
You can find a few articles on CodeGuru site http://codeguru.developer.com/splitter/index.shtml
0
 
LVL 3

Accepted Solution

by:
V_Bapat earned 300 total points
ID: 2545950
0
Get MongoDB database support online, now!

At Percona’s web store you can order your MongoDB database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card. Handle your MongoDB database support now!

 
LVL 12

Expert Comment

by:migel
ID: 2546469
Hi!
Also you can find some info in the PAQ:
http://www.experts-exchange.com/jsp/qShow.jsp?ta=mfc&qid=10201445 
0
 
LVL 4

Expert Comment

by:captainkirk
ID: 2547085
1) derive a splitter window class from CSplitterWnd and create a variable of that type in your main frame

2) create the new view:
CRuntimeClass* pView = RUNTIME_CLASS(YourNewViewClass);
int nView = nSomeViewID;
CView* pNewView = (CView*)pView->CreateObject();

if (pNewView)
{
    pNewView->Create(NULL, NULL, 0L, CFrameWnd::rectDefault, pParentWnd, nView, pContext);
      
pNewView->OnInitialUpdate();
} // end if


3) change to the new view:

UINT CYourSplitterWnd::ChangeView(CView* pNewPaneView, int row, int col, UINT nOldViewID, bool bFirstView)
{
     UINT nPaneViewID = IdFromRowCol(row, col);
     UINT nNewViewID  = pNewPaneView->GetDlgCtrlID();

     if (nNewViewID == 0)
     {
      return 0;
     } // end if
     else if (nNewViewID != (UINT) m_nCurrentViewID)
     {
      m_nCurrentViewID = nNewViewID;

      // set new view active and show it...
      CFrameWnd* pFrameWnd = GetParentFrame();

      pFrameWnd->SetActiveView(pNewPaneView);
      pNewPaneView->ShowWindow(SW_SHOW);
            
      // get old view, hide it, and remove from the splitter...
      CView* pOldPaneView = (CView*)GetDlgItem(nPaneViewID);

      if (pOldPaneView)
      {
            pOldPaneView->ShowWindow(SW_HIDE);
            pOldPaneView->SetDlgCtrlID(nOldViewID);
      } // end if

      // add the new view to the splitter...
      if (pNewPaneView->GetParent() != this)
            pNewPaneView->SetParent(this);

      pNewPaneView->SetDlgCtrlID(nPaneViewID);

      if (!bFirstView)
            RecalcLayout();
      } // end else
      
      return nNewViewID;
} // end ChangeView()


I belive that's the basics of it...
hope that helps...
0
 
LVL 8

Expert Comment

by:VinExpert
ID: 2562182
Hi,

Have the pointers of the CSplitterWnd and create them and display them. When U want to change it, delete the pointers so that view goes off and display the fresh view with the required change freshly. That should work though it is a work around method.

I had the similar problem, on some action, the requirement was to delete the view2 and show view1 abd view3 only. There I have followed the same way. I still have the sample of it too.

Try it out.

VinExpert
0
 

Author Comment

by:rgrand
ID: 2622639
all the information helps me to do my splitter.

Thanks, with some late. :)
0

Featured Post

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

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

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
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.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

770 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