• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 423
  • Last Modified:

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
 
0
martinmoessner
Asked:
martinmoessner
  • 2
1 Solution
 
AndyAinscowCommented:
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
 
AndyAinscowCommented:
Me.
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now