RichEditView MFC - How to change View focus

I'm writing on an MFC application using RichEditCtrl.
Cause it's an MDI application I have different views for each file I opened.
Now I wanna work with the viewed data. How can I access to a view which
is not the active view ? Or how can I unfocus a view and give the focus
to another view ?

Thanks in advance

Martin
 
martinmoessnerAsked:
Who is Participating?
 
AndyAinscowFreelance programmer / ConsultantCommented:
Now I wanna work with the viewed data. How can I access to a view which
is not the active view ?

Get the CWnd pointer (or window handle).

CMyView* pSomeOtherView = (CMyView*)pOtherWnd; //  you have to decide how to get the view you want
then code like
pSomeOtherView->m_ctlRichEdit.MemberFunctionYouWantToUse();




Or how can I unfocus a view and give the focus
to another view ?
pSomeOtherView->SetFocus();

from help
CWnd::SetFocus
CWnd* SetFocus( );

Return Value

A pointer to the window object that previously had the input focus. It is NULL if there is no such window. The returned pointer may be temporary and should not be stored.

Remarks

Claims the input focus. The input focus directs all subsequent keyboard input to this window. Any window that previously had the input focus loses it.

The SetFocus member function sends aWM_KILLFOCUS message to the window that loses the input focus and aWM_SETFOCUS message to the window that receives the input focus. It also activates either the window or its parent.

0
 
AndyAinscowFreelance programmer / ConsultantCommented:
Me.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.