Hi,
I've created an SDI app with multiple views using VS 2008 on XP Pro.
The main view is CView on which I draw some stuff. I have two secondary views, both are to be Rich Edit views allowing the user to modify data.
Having created a CRichEditView app in the past, I was thinking this would be easy. I started trying to use CRichEditView and realized quickly that it seems to be highly dependent on the doc and the container classes. So I switched to CView with a CRichEditCtrl sized to the client area of the view. This seems to work and text (that I create in OnDraw) is displayed but my problem is that I don't get the blinking cursor and I can't enter data directly into the control. It's like the control is read only. Any ideas?

I declare the control in my secondary CView's header file.

CRichEditCtrl m_RichEditCtrl;

I create the control in the CView's implementation file's OnCreate,

CRect rect(0,0,0,0);
if (CView::OnCreate(lpCreateStruct) == -1) return -1;
m_RichEditCtrl.Create(ES_AUTOVSCROLL | ES_MULTILINE | ES_WANTRETURN | WS_CHILD | WS_VISIBLE | WS_VSCROLL, rect, this, 1);
//AfxInitRichEdit2();
return 0;


I size the control to fit the client area in the CView's OnSize override,

CRect rect;
CView::OnSize(nType, cx, cy);
GetClientRect(rect);
m_RichEditCtrl.SetWindowPos(&wndTop, 0, 0, rect.right - rect.left,rect.bottom - rect.top, SWP_SHOWWINDOW);
long mask = m_RichEditCtrl.GetEventMask();
m_RichEditCtrl.SetEventMask(mask |= ENM_CHANGE );


and finally, in the CView's OnDraw,

m_RichEditCtrl.SetSel(0,-1);
m_RichEditCtrl.ReplaceSel("Hello World!");