The
EN_CHANGE
notification is send whenever the text is changed by user input or by setting the text using
SetWindowText()
/
WM_SETTEXT
for single line edit controls.
You have probably one or more places where the edit control is initialised when the parent window (a view in your case) is created.
A possible solution would be adding a member variable to your view class:
class CMyView : CView
{
bool m_bIgnoreChgEdtData;
};
void CMyView::OnitialUpdate()
{
m_bIgnoreChgEdtData = true;
m_bIgnoreChgEdtData = false;
}
void CMyView::OnChangeEdtData()
{
if (!m_bIgnoreChgEdtData)
{
}
}
To avoid executing the handler operations when calling
SetWindowText()
for the edit control somewhere in your code, do it the same way:
void CMyView::setEdt(LPCTSTR str)
{
m_bIgnoreChgEdtData = true;
m_edtData.setWindowText(str);
m_bIgnoreChgEdtData = false;
}