Solved

Updating a view based on dialog input

Posted on 1998-08-24
1
164 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
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…

623 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