how to add show/hide Cviews?

Posted on 2008-11-06
Last Modified: 2013-11-20
i have 4 views in splitterpanes in one window..and other views are in to show/hide by clicking toolbarbuttons?
CView* CMainFrame::SelectView(UINT nViewID)

      CView* pNewView = ((CTresManApp*)AfxGetApp())->GetView(nViewID);

      return pNewView;

CView* CMainFrame::SwitchToView(CView *pNewView)
      CView* pOldActiveView = GetActiveView();
//      CView* pOldActiveView = ((CTresManApp*)AfxGetApp())->GetView(1);

      CDocument* pActiveDocument = GetActiveDocument();

      ASSERT(pOldActiveView != NULL);
      ASSERT(pActiveDocument != NULL);
      ASSERT(pOldActiveView->GetDocument() == pActiveDocument);

      if (pNewView != pOldActiveView)
            // Show the newly active view and hide the inactive view.

      return pOldActiveView;

presently i have activeview it enables by clicking respective toolbar buttons but i want to show all 4 views in one window by clicking one toolbar button.
is it possible to activate morethan 1 view at a time?..
Question by:srikadi
    LVL 19

    Accepted Solution

    In order to hide/show a view you must show/hide its frame window:

    LVL 30

    Assisted Solution


    @alb66: this doesn't work for splitter windows.

    I think you'll have to delete the view to hide and create a new view to show - you can find a sample code at - there's a function 'CMainFrame::OnView1' which demonstrates this.

    Hope that helps,

    LVL 19

    Expert Comment

    Yes, my code show/hide all the views in the splitter window. May be I misunderstood the question.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
    Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
    This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
    The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

    737 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

    22 Experts available now in Live!

    Get 1:1 Help Now