Solved

Updating a view based on dialog input

Posted on 1998-08-24
1
162 Views
Last Modified: 2013-11-20
My app has a check list box (in a dialog) in which the user indicates which list items he'd like to see in the main list view.  When the user presses the OK button, the code correctly updates the data structure indicating which items to display.  And the CListView::OnUpdate() method correctly accesses this display data, to figure out which items to actually display.  But I don't know how to force the View to re-draw itself when the user presses OK.  I can't call CListView::OnUpdate() directly, since MVC++'s Class Wizard makes OnUpdate() a protected method..  How do I get the view to re-draw?  
0
Comment
Question by:MattEE
[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
1 Comment
 
LVL 2

Accepted Solution

by:
milenvk earned 50 total points
ID: 1321222
In the handler of the command, in which you open the dialog call your document's UpdateAllViews(NULL) after the user has hit the Ok button.
For example:

void CMyApp::OnLstDlg()
{
  CListDlg dlg;
  dlg.SetDisplayedItems(m_pMyDocument->GetDisplayedItems());
  if(dlg.DoModal() == IDOK)
  {
    // The following will call the OnUpdate() of all
    // the views of the document which will get redrawn
    m_pMyDocument->SetModifiedFlag();
    m_pMyDocument->UpdateAllViews(NULL);
  }
}
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
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.
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

752 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