1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Unlimited EditBox

Discussion in 'MFC' started by pm44xl22, Jul 7, 2010.

  1. pm44xl22

    pm44xl22 New Member

    Joined:
    Jul 7, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Hi all, I'm using a edit box as an "append log" for my program.

    I set it to "multiline" so I can write a new log every time. To write the log I append text using this code

    Code:
    CString strLine;
       // Add CR/LF to text
       strLine.Format(_T("\r\n%s"), pszText);
       // Get the initial text length
       int nLength = m_logedit.GetWindowTextLength();
       // Put the selection at the end of text
       m_logedit.SetSel(nLength, nLength);
       // Replace the selection
       m_logedit.ReplaceSel(strLine);
    

    The problem is that the edit box is keeping about 3-4000 lines. After that the edit box won't log more text and keeps itself stucked in adding more text.

    I thought two solutions:

    1) Increasing its size to unlimited or something
    2) Deleting previous text (like a ms-dos prompt does)


    Can you help me in the simpliest way you can please?
     
  2. NewsBot

    NewsBot New Member

    Joined:
    Dec 2, 2008
    Messages:
    1,267
    Likes Received:
    2
    Trophy Points:
    0
    The best option is to use Rich Text Box
     

Share This Page