I have a dropdown-list style CComboBox on a form. The nice thing about this style is it allows for type ahead--that is, you can type a character and it will jump to the first item in the list matching that character. However, there are certain items which need to be excluded from this behavior. How might this be accomplished?
Just as a simple (and maybe ugly) "trick" idea: Can you mask the items you want to exclude from type ahead search by any special character, like *
as first character for instance? (So you would add to the ComboBox *MyItemText
instead of MyItemText
.) If your item list needs to be sorted you have to switch off the autosort property of the ComboBox and do your own sorting (without the *
) before you add the items to the ComboBox. Users would also recognize that this is an item not to be found by type ahead (if this makes any sense or should be useful in your application).
The CComboBox does not have any Edit or TextChanged event. So my guess is that for another better solution you have to go the hard way and evaluate single keyboard events and run own your search through the item list. I don't have a better idea.