944,179 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Marked Solved
  • Views: 11229
  • C++ RSS
Jan 18th, 2006
0

New Lines in Visual C++ Multiline Edit Boxes?

Expand Post »
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?
Reputation Points: 10
Solved Threads: 0
Light Poster
ilikerps is offline Offline
45 posts
since Dec 2005
Jan 20th, 2006
0

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

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)
Reputation Points: 10
Solved Threads: 1
Newbie Poster
freespace is offline Offline
5 posts
since Dec 2005
Jan 20th, 2006
0

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

Hmm.... I tried this:
C++ Syntax (Toggle Plain Text)
  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.
Reputation Points: 10
Solved Threads: 0
Light Poster
ilikerps is offline Offline
45 posts
since Dec 2005
Jan 21st, 2006
0

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

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);
Reputation Points: 10
Solved Threads: 1
Newbie Poster
freespace is offline Offline
5 posts
since Dec 2005

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: What am i doing wrong?! Please help :)
Next Thread in C++ Forum Timeline: While loop not ending when reading from file





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC