views:

260

answers:

1

I'm using Visual Studio 2005 and programming a dialog-based MFC application in C++. I have an edit box and I'm trying to make it auto-scroll. When I make auto vscroll true, it still won't auto-scroll when I have too many lines in my edit box. Any ideas in what could be wrong? Is there maybe some code line I have to add to my edit box?

A: 

What do you mean by "Auto-Scroll"?

Turning on auto vscroll enables the ES_AUTOVSCROLL edit control style which:

ES_AUTOVSCROLL - Automatically scrolls text up one page when the user presses the ENTER key on the last line.

This may not be what you think "Auto-Scroll" means. A common misconception is that auto vscroll will automatically turn on/off the vertical scroll bar as more text is typed into the edit control. This is not the case, you have to either always have the scroll bar displayed or you have to come up with your own code to turn on and off the scroll bar yourself.

Shane Powell
Ok, so how do I write the code to make the scroll bar work?
Joe-Schmoe
No, it should work without any code. You have to say that you want a scroll bar. If there is nothing to scroll, it will display disabled. It's just how the builtin win32 controls work by default. What you have to code for is if you want to automatically display or hide the scroll bar when it's needed or not.
Shane Powell