How to autoscroll a multiline edit box?
Posted on 1999-01-07
I have implemented a modeless dialog box as an irc-style chat window for my network application (game). I created it using vc++ 5.0 with MFC. My current implementation is this...
When a new message is sent/received, I grab the text in the large multiline output box (main chat window), concatenate the new message to it in a temporary CString object, then set the edit box text to be the new, larger string. Everything has been working perfectly except for the fact that when the text reaches the bottom of the main (read-only) edit box and the scroll bar kicks in (thanks MFC), the box doesn't automatically scroll down to reveal the latest text. How do I make sure the box is always scrolled to the bottom when a new message comes in?
I guess my question is, how do I make a multiline edit box scroll down to the bottom within my code?
Oh...I have one more question. I have noticed that my modeless dialog box is sort of "always on top" of the main window. How do I make the main window appear over my modeless box when it's the active window? Is this a result of my subclassing in the main app, or does this always happen by default?