How to automatically add lines and scroll in CEdit?
-
Hello! I want to implement some kind of history log with CEdit controll. But here is the problem; CEdit only have SetWindowText method. Is there a way to add just one line of text? Now I do multiple lines with text in string buffer separated by "\r\n". To add some line, I add text to this buffer and separate it with "\r\n" and after it I call SetWindowText on CEdit control. Here I have a problem how many srolls to do when I get ower the edit control visible lines limit. Is there any better way? Just to add line of text and if out of visible lines srcoll just one line? Best regards, Rostfrei
-
Hello! I want to implement some kind of history log with CEdit controll. But here is the problem; CEdit only have SetWindowText method. Is there a way to add just one line of text? Now I do multiple lines with text in string buffer separated by "\r\n". To add some line, I add text to this buffer and separate it with "\r\n" and after it I call SetWindowText on CEdit control. Here I have a problem how many srolls to do when I get ower the edit control visible lines limit. Is there any better way? Just to add line of text and if out of visible lines srcoll just one line? Best regards, Rostfrei
I can think of two ways to add a line: - Call
GetWindowText
, tack on the new line then callSetWindowText
. This is somewhat inefficient. - UseEM_SETSEL
andEM_REPLACESEL
messages which are wrapped byCEdit::SetSel
andCEdit::ReplaceSel
respectively. Steve -
Hello! I want to implement some kind of history log with CEdit controll. But here is the problem; CEdit only have SetWindowText method. Is there a way to add just one line of text? Now I do multiple lines with text in string buffer separated by "\r\n". To add some line, I add text to this buffer and separate it with "\r\n" and after it I call SetWindowText on CEdit control. Here I have a problem how many srolls to do when I get ower the edit control visible lines limit. Is there any better way? Just to add line of text and if out of visible lines srcoll just one line? Best regards, Rostfrei
-
Hello! I want to implement some kind of history log with CEdit controll. But here is the problem; CEdit only have SetWindowText method. Is there a way to add just one line of text? Now I do multiple lines with text in string buffer separated by "\r\n". To add some line, I add text to this buffer and separate it with "\r\n" and after it I call SetWindowText on CEdit control. Here I have a problem how many srolls to do when I get ower the edit control visible lines limit. Is there any better way? Just to add line of text and if out of visible lines srcoll just one line? Best regards, Rostfrei
Set this style on for the edit control
ES_MULTILINE
. And for scrollbarsWS_HSCROLL
andWS_VSCROLL
.Jesus Loves:rose:
--Owner Drawn:rose: --Defeat is temporary but surrender is permanent --Jesus is Lord:rose:
-
I use this code: m_EditRcvdMsg.SetSel(-1, 0); //select no text m_EditRcvdMsg.ReplaceSel(pMsg); m_EditRcvdMsg.SetSel(-1, 0); //select no text m_EditRcvdMsg.ReplaceSel(_T("\r\n")); //scroll into position m_EditRcvdMsg.LineScroll(1);
-
Hello! I want to implement some kind of history log with CEdit controll. But here is the problem; CEdit only have SetWindowText method. Is there a way to add just one line of text? Now I do multiple lines with text in string buffer separated by "\r\n". To add some line, I add text to this buffer and separate it with "\r\n" and after it I call SetWindowText on CEdit control. Here I have a problem how many srolls to do when I get ower the edit control visible lines limit. Is there any better way? Just to add line of text and if out of visible lines srcoll just one line? Best regards, Rostfrei
Rostfrei wrote:
I want to implement some kind of history log with CEdit controll.
See here.
"The greatest good you can do for another is not just to share your riches but to reveal to him his own." - Benjamin Disraeli