c++visual-c++mfc

CEdit CR or LF pushing to next line?


When outputting text to CEdit, how can I alter the multiline to set it up so that only when a \n will it go to the next line?

ie:(setup programmatically)

CEdit *myEdit1 = new CEdit;
myEdit1->Create( ES_MULTILINE | ES_READONLY | WS_VISIBLE | WS_BORDER, CRect(800,100,900,200), this, 2);

if I feed this \n I want a the it to go to the next line (and only then)

CString s;
s = "hello \n there";
myEdit1->SetWindowText(s);

Solution

  • You may need to subclass CEdit to handle the keystrokes in that case. Otherwise the default behavior is to use Shift-Enter to jump to next line.

    Just search for CEdit subclassing and you will get lots of examples.