Solved

Multi-line CEditView

Posted on 1998-05-11
4
827 Views
Last Modified: 2013-11-20
I'm having a terrible time getting text to wrap in
a CEditView window.  I'm not certain if the underlying
CEdit is single-line or multi-line; it's acting like
single-line.  I tried overriding PreCreateWindow as
follows:

BOOL MyEditView::PreCreateWindow(CREATESTRUCT& cs)
{
      m_dwDefaultStyle = dwStyleDefault | ES_MULTILINE;
      return CCtrlView::PreCreateWindow(cs);
}

but that didn't work (and actually when I commented out
the " |ES_MULTILINE " part of the first line and looked
at m_dwDefaultStyle , it appeared that ES_MULTILINE was
set without my intervention).
There doesn't seem to be any member that tells me explicitly
whether I've succeeded in making the control multi-line.

I've tried calling CEdit::SetMargins(), CEdit::FmtLines(),
and CEdit::SetRect() on the control, and no matter
what I do, the text *just* *won't* *wrap*.

If it matters, the CEditView window is a pane of
a splitter window.
0
Comment
Question by:trovatore
  • 2
  • 2
4 Comments
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 50 total points
ID: 1309736
Make sure that the text you entered or reading from a file has a \r\n as the paragraph mark.

Additionally, check to make sure your edit control does not have WS_AUTOHSCROLL as a style (use GetStyle()).
0
 

Author Comment

by:trovatore
ID: 1309737
I don't follow the first sentence.  When the box comes up
there's nothing in it; if I just enter a bunch of text I
want it to wrap when it gets to the right margin.  And it
doesn't.

I did have ES_AUTOHSCROLL on but now I don't, and it hasn't
fixed it.

0
 
LVL 15

Expert Comment

by:Tommy Hui
ID: 1309738
Also turn off WS_HSCROLL style.
0
 

Author Comment

by:trovatore
ID: 1309739
That's got it; thanks.

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Question regarding Copy/Paste 16 91
maxBlock challenge 30 111
string initialization in java 11 109
conditional code and condition difference 9 76
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. …
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

929 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now