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
Solved

MFC,C++: Updating a view without calling its documents UpdateAllViews

Posted on 2007-12-05
4
1,020 Views
Last Modified: 2013-12-14
I would like to update an MFC view when it is about to be displayed. I can only do this though a generic CView pointer, so the only functions of my own I can call are overloaded functions. I essentially want to call OnUpdate(), but cannot, as it is private. Only the framework may call OnUpdate(). That being the case, how can I update a single view, without calling my document's UpdateAllViews()?

Regards,
Sternocera
0
Comment
Question by:sternocera
  • 2
  • 2
4 Comments
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 20411306
Two ways.
Use the UpdateAllViews and use lHint / pHint to stop views being pdated that you don't want updating.
Or in the OnUpdate call a public function eg. UpdateThisView, then for just updating one view call this directly pView->UpdateThisView();
0
 

Author Comment

by:sternocera
ID: 20411372
Andy,

I cannot know in advance exactly what sort of object my generic CView* will point to, which is why it is just a generic CView* , so I can't call anything that is not a CView member function. A bunch of views exist on the heap, and my generic CView* points to the currently viewed one.

I guess that just leaves the Hint method.

0
 
LVL 44

Accepted Solution

by:
AndyAinscow earned 500 total points
ID: 20411460
Nope - you can use a custom message eg WM_APP+123.  Pass it to the view in a SendMessage (or PostMessage) and it will be handled if the view knows how to respond to that message else it will end up in the great bit bucket in the bowels of windows.
0
 

Author Comment

by:sternocera
ID: 20411549
You're right - I should just send a custom message to have the view update,

very colourful analogy :-)

Thanks
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone 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

Suggested Solutions

Title # Comments Views Activity
SSIS 2010 Convert to SSIS 2013 On Different Box 3 60
How do ASP.NET and MVC work together? 4 62
Way to decrease size of apk file 9 86
Why use this lambda? 12 26
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

792 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