Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Updating a view based on dialog input

Posted on 1998-08-24
1
Medium Priority
?
172 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
1 Comment
 
LVL 2

Accepted Solution

by:
milenvk earned 150 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Suggested Courses

927 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