2 years ago

#23243

test-img

Michal Hadraba

User Subclassed class from CEdit value validation if DDX_Text is use

I have my own class (CMyEdit) subclassed from CEdit with own validation procedure.

I hook events ON_CHAR and ON_UPDATE and validate user input.

If the input is valid, attribute CMyEdit::isOk is switched to true. CMyEdit confirms validity during each change of EditBox content.

Dialog could confirm validity by CMyEdit::isOk.

I have overridden CEdit::SetWindowText()

inline void CMyEdit::SetWindowText(LPCTSTR lsText)
{
    CEdit::SetWindowText(lsText);
    Validate(); //set isOk true or false
}

But if dialog uses DDX_Text, no method is running (Nor EN_CHANGE, neither SetWindowText).

The same problem is, when user put value from clipboard (WM_PASTE).

How to hook this change of EditBox content?

c++

winapi

mfc

dialog

cedit

0 Answers

Your Answer

Accepted video resources