views:

294

answers:

2

I have a CEdit control that's used to display a diagnostics output.
Sometimes the data overflows the screen size, so naturally I set the Vertical Scroll property to true (MFC dialog editor).

But then, when I tried to scroll the text that was in the window before isn't cleared and the new text is written over it.

The result is a big mess of everything I have scrolled past.

I've looked for a draw background property or something similar that will erase everything in the window while scrolling (before redrawing the new data).

Any suggestions?

A: 

I think you might want to set Auto VScroll and Multiline to true, and Auto HScroll to false.

djeidot
Everything is already setup as you suggested except auto HScroll, which had no effect.
CodeFusionMobile
A: 

I tested this with VS2005, which ships with MFC 8.0. I couldn't replicate your problem.

I added one CEdit and one CRichEditCtrl to a dialog based app. Changed properties Multiline, Auto VSCroll and Vertical Scroll to true. Used SetWindowText-method to put loooooong string of text to both of them. I started the app and text scrolled just fine.

What did you do differently?

Just to be sure. You didn't use the SetCaretPos-method, did you? There was some note about that in the MSDN page. Here's the Knowledge Base article.

Rope
I seem to recall seeing the SetCaretPos method in the code somewhere, I'll check when I get back to work. Thanks for the tip.
CodeFusionMobile
Also, I am working with 2003 because it's old code, so that may effect it as well.
CodeFusionMobile
Added direct link to Knowledge Base article regarding SetCaretPos. Sadly, it doesn't describe possible symptoms of using SetCaretPos in CEdit. Article was written for MFC 4.2 which was used in Visual C++ 4.2, so maybe it has been fixed since then. Try it on and let us know.
Rope