开发者

Catching Enter Keypress from a CComboBox

Once a user types something in to my CComboBox (within a CDialog sub开发者_如何学Cclass) and presses Enter, I would like to add what they've written to the list of options, and do some other handling. How do you do that in MFC?


Here is some information you might find useful:

The ENTER key, by default, is only processed by the combo box when the drop list is open, and in this case it has the same effect as a mouse click and makes the selection. A Simple combo box does not process the ENTER key at all and is passed to the parent dialog. If you wish to handle the ENTER key in any other way the combo box will need to be subclassed and handler written for the purpose. You may like to check out Implementing an autocompleting Combobox - By Chris Maunder as a starting point to which the handler can be added.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜