Solved

Updating a view based on dialog input

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Perl Awk Need Help 3 118
Expand to include initial dialog with two choices. 9 78
Process filename extension 3 186
mapAB Challlenge 35 145
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
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. …
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.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …

809 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