简体   繁体   中英

Keyboard Enter key not working in MFC Dialog Box?

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 ?

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.

在这种情况下,请处理数据库的pretranslate()方法中的enter键。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM