How to set multiline text in a CEdit? 
Author Message
 How to set multiline text in a CEdit?

Hi all,

I have a CEditView, and I wish to set the text within it to a particular
multiline output. I obtain a point to the CEdit control within it, and
then use SetWindowText();  I will certainly compile the text itself in a
buffer of some kind, because it will change depending on the doc.

The line breaks in a CEdit are supposed to be \n\n\r, or some variation on
a soft break theme.  But, of course, every time I try to put together a
buffer containing these characters, it won't work.

CString line1 = "Line 1\n\n\r";
CString line2 = "Line 2\n\n\r";
line1+=line2;

SetwindowText(line1);   // No good, it's all on one line

I have tried implementing a CByteArray, filling it one letter at a time,
and then copying it into a static char array, but the \n's all come out as
non-printable characters (ie '|').  Can anyone tell me how to have
multi-line text?  If you have any better ideas for a CEditView, they would
be welcome too.

--------------
Richard Cavell
Melbourne University Medical Student, Debater, Chess Player, etc.

Celebrating the Micro$oft breakup.
Newsgroups - Please keep it on the group, and copy your replies to me via
email. (Server problems).



Tue, 24 Dec 2002 03:00:00 GMT  
 How to set multiline text in a CEdit?

Use \r\n to break a line.

--
Ajay Kalra

Microsoft VC++/MFC MVP
MVP VC FAQ: http://www.mvps.org/vcfaq

Note: Please post all replies to newsgroup only.



Quote:
> Hi all,

> I have a CEditView, and I wish to set the text within it to a particular
> multiline output. I obtain a point to the CEdit control within it, and
> then use SetWindowText();  I will certainly compile the text itself in a
> buffer of some kind, because it will change depending on the doc.

> The line breaks in a CEdit are supposed to be \n\n\r, or some variation on
> a soft break theme.  But, of course, every time I try to put together a
> buffer containing these characters, it won't work.

> CString line1 = "Line 1\n\n\r";
> CString line2 = "Line 2\n\n\r";
> line1+=line2;

> SetwindowText(line1);   // No good, it's all on one line

> I have tried implementing a CByteArray, filling it one letter at a time,
> and then copying it into a static char array, but the \n's all come out as
> non-printable characters (ie '|').  Can anyone tell me how to have
> multi-line text?  If you have any better ideas for a CEditView, they would
> be welcome too.

> --------------
> Richard Cavell
> Melbourne University Medical Student, Debater, Chess Player, etc.

> Celebrating the Micro$oft breakup.
> Newsgroups - Please keep it on the group, and copy your replies to me via
> email. (Server problems).



Tue, 24 Dec 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. How to set text into CEdit (Multiline)

2. Set text color for 1 line in a CEdit control (MultiLine)

3. Colored text in MultiLine CEdit

4. Text erases itself in my multiline CEdit ! Help

5. again, CEdit multiline text

6. Need to Set text from Dialog CEdit to Active Window in MDI text app

7. Setting Text in CEdit with SetWindowText()

8. Setting text in CEdit ctrl

9. Setting text and background color in CEdit

10. multiple-line CEdit set multi-line text

11. How to set text in CEdit

12. Setting CEdit Text in Modal Dialog

 

 
Powered by phpBB® Forum Software