Solved

How to display multiple lines in a edit box at runtime?

Posted on 2001-07-11
2
229 Views
Last Modified: 2013-11-20
Hello everyone,

  I want to display multiple lines in a edit box at run time.

  What I did was as follows:
   szNewLine.Format("%s\n%s", szPrevLine, szLine);
   pEdit->SetWindowText(szNewLine);
  Instead of seeing two lines inside the edit box as I expected, I saw one line with a CR separating two strings. How can I implement multiple lines at run time as if the user hits enter within a multiple-lined edit box?

  Thanks.

Nancy



0
Comment
Question by:qwang73
2 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 50 total points
ID: 6275223
You'll have to make sure that the edit field has the 'ES_MULTILINE' style set (you can check/set that in the resource editor). Furthermore, you'll have to use the correct linebreak:

  szNewLine.Format("%s\r\n%s", szPrevLine, szLine);
  pEdit->SetWindowText(szNewLine);

'\r\n' is what you'll need.


0
 

Author Comment

by:qwang73
ID: 6275331
jkr,

  Thanks for your answer and the note about duplicate question. '\r\n' is exactly what I need. Funny thing is that I tried to put 0x0A(LF) and 0x0D(CR) at the end and it didn't work. Is that the same as '\r\n'?

Nancy
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
notReplace  challenge 53 141
fizzArray  challenge 1 96
zeroFront challenge 7 111
changeXy challenge 13 88
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question