?
Solved

How do I Hide Child Views in a MDI Application?

Posted on 2003-03-12
2
Medium Priority
?
261 Views
Last Modified: 2013-11-20
I have a list of CViews which are Child windows.  I want to iterate over this list and HIDE (not close or destroy) each Child View in the list.  I can't get this to work. So far I have tried:

CMainFrame * pFrame = (CMainFrame *)::AfxGetMainWnd();
POSITION pos = m_lstViews.GetHeadPosition();
CView * pCurrentView = m_lstViews.GetNext(pos);

while (pCurrentView)
{
   pCurrentView->ShowWindow(SW_HIDE);
   pFrame->RecalcLayout();
   pCurrentView = (pos) ? m_lstViews.GetNext(pos) : NULL;
}

Any help would be great!
0
Comment
Question by:bcoffe2000
[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
2 Comments
 
LVL 23

Accepted Solution

by:
Roshan Davis earned 200 total points
ID: 8118735
You have to call View's GetParentFrame  and hide that window instead of the view like...

CMainFrame * pFrame = (CMainFrame *)::AfxGetMainWnd();
POSITION pos = m_lstViews.GetHeadPosition();
CView * pCurrentView = m_lstViews.GetNext(pos);

while (pCurrentView)
{
  //pCurrentView->ShowWindow(SW_HIDE);
  CFrameWnd *pFrameWnd = pCurrentView->GetParentFrame();
  pFrameWnd->ShowWindow(SW_HIDE);

  pFrame->RecalcLayout();
  pCurrentView = (pos) ? m_lstViews.GetNext(pos) : NULL;
}


Good Luck
0
 

Author Comment

by:bcoffe2000
ID: 8118805
THANK YOU!! I knew it had to be something to do with some Frame...I just couldn't figure it out. Thanks Again.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
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.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

764 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