Reputation: 1200
I have a CFormView derived class where I want to call a method when focus is lost.
Tried this:
MyClass.cpp
ON_CONTROL_REFLECT(EN_KILLFOCUS, OnKillFocus)
void CMyClass::OnKillFocus()
{
}
MyClass.h
afx_msg void OnKillFocus();
But my method is not being called, is there some way to achieve what I want?
Upvotes: 2
Views: 2200
Reputation: 31629
Relevant message and functions are
ON_WM_KILLFOCUS()
and
afx_msg void OnKillFocus(CWnd* pNewWnd);
EN_KILLFOCUS
and other EN_XXX
notifications are specific to Edit controls. For example:
BEGIN_MESSAGE_MAP(CMyDialog, CDialog)
ON_EN_KILLFOCUS(IDC_EDIT1, OnMyFunction)
END_MESSAGE_MAP()
void OnMyFunction();
Upvotes: 3