Scrolling to the bottom+colors
-
2 questions 1) I have a Rich edit control in a dialog box. I add text to the end through a CString. I want to keep the scroll position it the bottom of the text. Whenever you call UpdateData (FALSE); it springs back to the top of the text. I've had a look at the setscrollpos, etc (that are in CWnd), but they are not very effective. 2) In the rich edit control i want to have different colours, but since the user does not enter text directly i use updatedata and all formatting is lost (and all text goes to the last setting used). Anyway around this? thanks
-
2 questions 1) I have a Rich edit control in a dialog box. I add text to the end through a CString. I want to keep the scroll position it the bottom of the text. Whenever you call UpdateData (FALSE); it springs back to the top of the text. I've had a look at the setscrollpos, etc (that are in CWnd), but they are not very effective. 2) In the rich edit control i want to have different colours, but since the user does not enter text directly i use updatedata and all formatting is lost (and all text goes to the last setting used). Anyway around this? thanks
for question #1 Have you tried the LineScroll() member function ? For example, after UpdateData(FALSE); int nVis = m_edit1c.GetFirstVisibleLine(); int nscroll = m_edit1c.GetLineCount() - nVis; m_edit1c.LineScroll(nscroll); (assuming that you have a control variable, m_edit1c, associated with the Rich edit control)