Solved

Updating a view based on dialog input

Posted on 1998-08-24
1
156 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 50 total points
Comment Utility
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Host to IP 7 73
Perl Awk Need Help 3 94
sum67 challenge 35 88
Dell Alienware Graphics Amplifier Driver for non-Alienware systems 18 111
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

772 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

10 Experts available now in Live!

Get 1:1 Help Now