NextDlgCtrl() goes to wrong control----Why
Posted on 2006-04-19
I have a class derived from a class that is, itself, derived from CEdit. This class is supposed to allow exactly one character to be entered, one of "YyNn", and then move on to the next control. I am using OnChange to accomplish this
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CEdit::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
// TODO: Add your control notification handler code here
It works perfectly except for the fact that it actually sets focus to the previous control rather than the next control. If I comment out the NextDlgCtrl() line, the focus stays on this control, and if I press the TAB key, it goes properly to the next control. I've confirmed that pParent is, in fact, the parent CDialog. BTW, this control is the very last control of the CDialog parent, although the MFC doc says that it will go to the first if on the last.
Any ideas will be greatly appreciated.