Solved

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

Posted on 2007-12-05
4
1,028 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Android studio getdrawable(int) is deprecated 4 156
Insert several multiple frames into a single mainframe 3 69
String manipulation in Visual Basic 7 81
Not needed 13 128
After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.
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.

713 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