views:

233

answers:

1

Once a user types something in to my CComboBox (within a CDialog subclass) 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?

A: 

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.

demoncodemonkey