Reputation: 8941
Keyboard Enter key not working in MFC Dialog Box ? I have one MFC Login dialog box when I enter Username and password and hit Enter key the dialog box close down while when I use mouse to click on login it login's successfully.
What I need to do for making keyboard key work in MFC ?
Upvotes: 0
Views: 3649
Reputation: 877
Go to the resource view and make sure you have no entry for VK_RETURN with no modifier in Accelerators. This might be a cause too.
Upvotes: 0
Reputation: 43585
Implement the OnOK()
and/or the OnCancel()
methods and don't call the base methods there.
(those are virtual methods which you can simply overload).
Just because you removed the buttons doesn't mean you don't have to handle the events!
The OnOK()
is triggered by the Enter key, and OnCancel()
by the Escape key for dialogs.
Upvotes: 3
Reputation: 168
in this case handle the enter key in the pretranslate() method of your db.
Upvotes: 0