Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 285
  • Last Modified:

Setting the text on a CEdit Control

The the situation is as follows.

I have a CStringList with an un known number of strings stored in it (rollResults). I also have a CEdit control for output (m_rollResults). Each string ends with a '\n' character.

CStringList output;
// m_rollResults is type CEdit
// fill out put with various data

// clear anything in the in the edit box
m_rollResults.SetSel(0, -1);
m_rollResults.Clear();

// place all the strings in output, into m_rollResults
for(POSITION pos = output.GetHeadPosition(); pos != NULL; )
    m_rollResults.ReplaceSel(output.GetNext(pos));

Everything seems to work except all the output is placed on one line. I do not want to use word wrap or anything like that. I want each string to be placed on a new line in the CEdit control. I have tryed placing a '\n', '\r', and '\0' char at the end of each line but all it did was print an unknow char.

I know I am doing things in a round about way. I will up the point if anyone can show me the proper way of doing this.
0
gandalf79
Asked:
gandalf79
  • 2
  • 2
  • 2
1 Solution
 
jkrCommented:
You will have to put a "\r\n" at the end of each line to achieve the desired effect.
0
 
gandalf79Author Commented:
I tried that but it would only print those unknown char boxes.
0
 
jkrCommented:
Do you have "multiline" enabled? "\r\n" used to work the last 10 years...
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
gandalf79Author Commented:
Thanks for your help. Feel kind of silly now knowing the answer was as simple as a check box i had looked at several times. I appriseate your quick responce.

gandalf79
0
 
AlexNekCommented:
2 gandalf79
>Each string ends with a '\n' character.
It is possible that you have "\n\r\n".
First try to remove '\n' and add "\r\n". (Or replace last character)
In addition, you must check that your edit control has style "Multiline". (Use resource editor)

0
 
AlexNekCommented:
I'm sorry, I have only first 3 posts when I start to answer.
0

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

  • 2
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now