New Lines in Visual C++ Multiline Edit Boxes?

Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Dec 2005
Posts: 45
Reputation: ilikerps is an unknown quantity at this point 
Solved Threads: 0
ilikerps ilikerps is offline Offline
Light Poster

New Lines in Visual C++ Multiline Edit Boxes?

 
0
  #1
Jan 18th, 2006
I have an edit box, with its settings as "multiline", "want return", and "vertical scroll."
All I want to do is to have new lines between each output line. However, I have tried "\n", which did not work. So, is there a way to make them have line breaks?
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5
Reputation: freespace is an unknown quantity at this point 
Solved Threads: 1
freespace freespace is offline Offline
Newbie Poster

Re: New Lines in Visual C++ Multiline Edit Boxes?

 
0
  #2
Jan 20th, 2006
Mdos uses one character to represent a newline ascii character number 10.
Windows app's however use two characters to represent a newline, ascii characters numbers 13 and 10.

In a multline control to get a newline you have to use char(13) followed by char(10)
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 45
Reputation: ilikerps is an unknown quantity at this point 
Solved Threads: 0
ilikerps ilikerps is offline Offline
Light Poster

Re: New Lines in Visual C++ Multiline Edit Boxes?

 
0
  #3
Jan 20th, 2006
Hmm.... I tried this:
  1. m_ChatText = "Hello!";
  2. MessageBox(m_ChatText);
  3. m_ChatText += char(13) + char(10);
  4. MessageBox(m_ChatText);
  5. m_ChatText += "How are you?";
  6. MessageBox(m_ChatText);
The output is:
Hello!
Hello!|-
Hello!|-How are you?


Carriage return, line feed does make sense but it isn't working, at least not how I am implementing it in the above.

So I tried using both escape sequences /r/n which does make a newline.
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5
Reputation: freespace is an unknown quantity at this point 
Solved Threads: 1
freespace freespace is offline Offline
Newbie Poster

Re: New Lines in Visual C++ Multiline Edit Boxes?

 
0
  #4
Jan 21st, 2006
m_ChatText += char(13) + char(10);
might not work as expected.
the compiler sees char(13) + char(10) like 13 + 10 = 23

So its like writing
m_ChatText += char(23);
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC