Click to See Complete Forum and Search --> : Line feeds and tabs in an edit control


TrimTrom
August 21st, 1999, 03:33 PM
Hello,
I am a beginner using VC++6.0 Professional on Windows 98

I am writing an application which uses several views combined with a
splitterbar as its first screen. One of these views is a CEditView,
which is where my problem is.

For the text of the CEditView I want to concatenate several text
variables, with their contents each being shown on separate lines. I
had tried to do it as follows:

void CPTEditView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint)

{
// TODO: Add your specialized code here and/or call the base class
CEdit &pEdit = GetEditCtrl();
CString mText = "All together ";
CString Text1 = "this is written ";
CString Text2 = "on several lines.";
mText = mText + '\n' +Text1 + '\n' + Text2;
pEdit.SetWindowText((LPCTSTR)mText);
}



However the edit control does not recognise the "\n" and merely prints
all the text on a continuous line. I had also wanted to format some of
the lines with tabs (ie "\t"), and these are not recognised either.

I would be very grateful for code snippets showing me how to incorporate
line feeds and tabs into my edit view.

Hopefully,
TrimTrom

----------------------
Paul Trimming
Surrey,England
--------------------

Keith House
August 21st, 1999, 06:54 PM
Try using "\r\n".