Solved

Setting the text on a CEdit Control

Posted on 2002-05-27
6
264 Views
Last Modified: 2013-11-20
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
Comment
Question by:gandalf79
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
6 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 7037829
You will have to put a "\r\n" at the end of each line to achieve the desired effect.
0
 
LVL 2

Author Comment

by:gandalf79
ID: 7037835
I tried that but it would only print those unknown char boxes.
0
 
LVL 86

Accepted Solution

by:
jkr earned 150 total points
ID: 7037839
Do you have "multiline" enabled? "\r\n" used to work the last 10 years...
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Author Comment

by:gandalf79
ID: 7037851
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
 
LVL 16

Expert Comment

by:AlexNek
ID: 7037861
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
 
LVL 16

Expert Comment

by:AlexNek
ID: 7037863
I'm sorry, I have only first 3 posts when I start to answer.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
In this post we will learn different types of Android Layout and some basics of an Android App.
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.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

735 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