rosenav
asked on
Modeless dialog disappears in MFC, NOT caused by OnOK.
I have a modeless dialog box derived from CDialog with OnOK and OnCancel both overridden as {}. However, if the dialog itself has focus (ie not a button, radiobox, etc) and the user presses SPACE, RETURN, or ENTER the box becomes invisible but is not destroyed. Any idea of what messages/commands I should be looking for that would cause this to happen?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Great suggestion AlexFM. Didn't solve my problem but it did show that the dialog isn't recieving RETURN or ESC keys. In fact, nothing on the dialog has the little dotted-line focus highlight painted on it until I specifically click one of the controls. After that point it behaves as expected (doesn't disappear anymore). Is there a reliable way to force a control to have the focus?
ASKER
I still don't know why the dialog was disappearing but I was able to make it stop by forcing an arbitrary control in the dialog to have the focus.
Can you post some code maybe?