Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Vangelis

Win32: Adding text to multiline edit box

This topic is 5455 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a edit box with the following styles defined.
WS_CHILD | WS_VISIBLE | WS_VSCROLL | ES_LEFT | ES_READONLY | ES_MULTILINE | ES_AUTOVSCROLL  
The edit box show's up correctly and with all visual styles I want, but I'm having trouble adding multiple lines to the box. I used a stringstream because I want to ease the process of int->string conversion. Here's the code I'm using to (hopefully) output multiple lines to the edit box.
stringstream ss;
ss << "Name: " << stringName << "\r";
ss << "Quote: " << stringQuote << "\r";

SendMessage(npcEditBox,WM_SETTEXT,0,(LPARAM)ss.str().c_str());  
But when I run this and check the contents of the edit box I get a string like "Name: NPCName|Quote: NPCQuote|" (all on one line). It doesn't seem to recognize the \r, which should be the escape character for a carriage return. Is there another escape character I should use, or does it have to do with stringstream? BTW I'm running VC++ 6 (if it matters) [edited by - Vangelis on August 14, 2003 5:24:36 AM]

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
"\r\n"

Share this post


Link to post
Share on other sites
Thank you AP, that works wonderfully. I''m not too sure why though, "\r" is a carriage return and "\n" is a new line. Why when I go something like "cout << "text\n";" I do not need a carriage return?

Just some curious questions, thanks for the help.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!