Solved

Multi-line CEditView

Posted on 1998-05-11
4
836 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
[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
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

Enroll in June's Course of the Month

June's Course of the Month is now available! Every 10 seconds, a consumer gets hit with ransomware. Refresh your knowledge of ransomware best practices by enrolling in this month's complimentary course for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

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

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
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.
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

705 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