I have a dialog with a CComboBox
in the DropList style. I want it to call my function (e.g. LoadData()
) when:
- user clicks an item in the drop list, or
- an item in the drop list is highlighted (either by mouse hover or keyboard), and user presses enter
but NOT when the user is still typing text in #2.
Calling LoadData()
in the ON_CBN_SELCHANGE
handler works fine for #1, but for #2 this event fires on every keystroke instead of only on enter. In other words, if I have combobox items:
1
12
123
and I type 12
, it will trigger ON_CBN_SELCHANGE
once for 1
, once for 12
... but really I'm trying to type 123
, so I don't want those first 2 keystrokes to result in LoadData()
calls.
What's the correct way to implement this?