Go to the end of rich edit control
-
Hi, How can I move the edit cursor to the end of a rich edit control? I need to append text to the end. Thanks in advance, Erik Hammar
-
Hi, How can I move the edit cursor to the end of a rich edit control? I need to append text to the end. Thanks in advance, Erik Hammar
I do it in Win32 like this:
::SetFocus (editControl);
::SendMessage (editControl, EM_SETSEL, (WPARAM)length, (LPARAM)length);
::SendMessage (editControl, EM_REPLACESEL, 0, (LPARAM) ((LPSTR) str.c_str()));I'm sure the MFC class for a rich edit will have methods so you don't need to send messages like this. The basic idea is make the cursor select the end position of the text in there, and then replace the selection ( which is really a caret at the end of the line ) with the text you want to append. length obviously equals the length of the text already there. Christian After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001