how to make my rich edit ctrl scroll automatically when insert new text?
-
how to make my rich edit ctrl scroll automatically when insert new text? here's how i insert text
msg.Insert( msg.GetLength() , "\n"); m_system_message.SetSel(-1,-1); m_system_message.ReplaceSel(msg);
here's how the richedit is defined in the resource fileCONTROL "",IDC_SYSTEM_MESSAGE,"RICHEDIT",ES_MULTILINE | ES_AUTOVSCROLL | WS_BORDER | WS_VSCROLL | WS_TABSTOP,11, 257,241,52
as you guys can see, ES_AUTOVSCROLL is definately there but whenever i insert new text using ReplaceSel, the text focus is always at the top. how do i make it such that it automatically scrolls down to read the latest text inserted? using - mfc - vc6.0 - winxp thanks in advance! -
how to make my rich edit ctrl scroll automatically when insert new text? here's how i insert text
msg.Insert( msg.GetLength() , "\n"); m_system_message.SetSel(-1,-1); m_system_message.ReplaceSel(msg);
here's how the richedit is defined in the resource fileCONTROL "",IDC_SYSTEM_MESSAGE,"RICHEDIT",ES_MULTILINE | ES_AUTOVSCROLL | WS_BORDER | WS_VSCROLL | WS_TABSTOP,11, 257,241,52
as you guys can see, ES_AUTOVSCROLL is definately there but whenever i insert new text using ReplaceSel, the text focus is always at the top. how do i make it such that it automatically scrolls down to read the latest text inserted? using - mfc - vc6.0 - winxp thanks in advance!Im not sure see A Rich Edit Control That Displays Bitmaps and Other OLE Objects[^] does helpful?
WhiteSky
-
how to make my rich edit ctrl scroll automatically when insert new text? here's how i insert text
msg.Insert( msg.GetLength() , "\n"); m_system_message.SetSel(-1,-1); m_system_message.ReplaceSel(msg);
here's how the richedit is defined in the resource fileCONTROL "",IDC_SYSTEM_MESSAGE,"RICHEDIT",ES_MULTILINE | ES_AUTOVSCROLL | WS_BORDER | WS_VSCROLL | WS_TABSTOP,11, 257,241,52
as you guys can see, ES_AUTOVSCROLL is definately there but whenever i insert new text using ReplaceSel, the text focus is always at the top. how do i make it such that it automatically scrolls down to read the latest text inserted? using - mfc - vc6.0 - winxp thanks in advance!I think ES_AUTOVSCROLL is there to help scroll the window when the user inputs text using the keyboard etc. But for automatic additions to the control, I think you could send it a message to scroll itself after adding text to it.
//Add text to it here. m_system_message.SendMessage(WM_VSCROLL,MAKEWPARAM(SB_BOTTOM,0));
Then it should scroll to the bottom, and the cursor, if in it, should appear at the end of the last line.this is this.