Link to home
Start Free TrialLog in
Avatar of rosenav
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?
Avatar of mac-will01
mac-will01

This is strange behaviour.  I just quickly tried a dummy project and I found that I didn't get this behaviour.
Can you post some code maybe?
ASKER CERTIFIED SOLUTION
Avatar of AlexFM
AlexFM

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rosenav

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?
Avatar of rosenav

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.