Refresh view in "for" loop 
Author Message
 Refresh view in "for" loop

I made a fonction whit a for loop in my CDoc. The view is only refresh when
the loop (the fonction) is end.
How can I display and refresh the view at the end of EACH iteration of the
loop ?

Thanks.



Sat, 13 Oct 2001 03:00:00 GMT  
 Refresh view in "for" loop

Quote:
> I made a fonction whit a for loop in my CDoc. The view is only refresh
when
> the loop (the fonction) is end.
> How can I display and refresh the view at the end of EACH iteration of
the
> loop ?

Basically, you can use 'InvalidRect' and 'UpdateWindow' sequentially
within the body of iteration.  'UpdateWindow' function calls 'OnDraw'
function of your view class.

You can use MSDN for the usage of this function.
Good luck to you.

yahn



Sun, 14 Oct 2001 03:00:00 GMT  
 Refresh view in "for" loop
Hello,

Based on your message I am not sure I understand your problem completely,
however I would suggest you try the following approach:
    - In you "for" loop, call the CDocument::UpdateAllViews() function.
This will walk through the list of all the views attached to this document
and call their OnUpdate() function.
    - Implement (override with ClassWizard) the OnUpdate() function for
your views, and repaint your views. The default implementation simply calls
Invalidate() and UpdateWindow(), which invalidates the whole view and
causes an immediate repaint (hence calling OnDraw()). You might keep this
behavior or try to optimize it...

Find more than 130 similar and advanced tips and techniques in "The MFC
Answer Book: Solutions for Effective Visual C++ Applications". For
additional details, surf to <http://www.mfcfaq.com>.

Good luck!

- Eugene Kain
Author of "The MFC Answer Book: Solutions for Effective Visual C++
Applications" (Addison-Wesley, 1998).
Visit the book's web site at <http://www.mfcfaq.com>
Get the best prices at
<http://www.amazon.com/exec/obidos/ASIN/0201185377/mfcfaqcom>

Quote:

>I made a fonction whit a for loop in my CDoc. The view is only refresh
when
>the loop (the fonction) is end.
>How can I display and refresh the view at the end of EACH iteration of the
>loop ?

>Thanks.



Sun, 14 Oct 2001 03:00:00 GMT  
 Refresh view in "for" loop

Quote:

> I made a fonction whit a for loop in my CDoc. The view is only refresh when
> the loop (the fonction) is end.
> How can I display and refresh the view at the end of EACH iteration of the
> loop ?

I assume you're calling UpdateAllViews at the end of the loop?  Also, if this
is a tight processing loop, you'll need to let the message pump have a chance
so that your view can repaint.  Read the following Knowledgebase article for
more information:

Q99999 INFO: Background Processing in an MFC Application

Jim [VC/MFC MVP]
To send mail, change spam-me-not to msn



Sun, 14 Oct 2001 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Loop or Loops in "C"

2. CListCtrl and "refresh"...

3. How to refresh "device manager"?

4. intercepting "refresh" Windows OS events

5. Optimising "conditional" while loop

6. Optimising "conditional" while loop

7. "For" loop problem

8. "for loops" - for newbie

9. HELP with "pretest for() loop"

10. Careful "for" Loops

11. Broken Rule For "For -- Loop"

12. remove() vrs fopen("""w")

 

 
Powered by phpBB® Forum Software