clear text portion of a dropdown list style combo box
Posted on 1997-10-23
I want to clear the text portion of a dropdown list style combo box.when the user presses the delete key. To support this, I have made the first item in the list an empty string. Then I have provided an OnKeyDown handler in a derived CCombo class. It almost works. If the user tabs into my combo box, presses DEL, and tabs out, everything is as expected. However if he presses DEL when the list box portion is dropped, the edit portion clears as expected, but then when the user tabs to the next control, the previous contents of the combo box are restored. How can I prevent this. Here's my OnKeyDown code.
void MyCombo::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
if (nChar == VK_DELETE)
CComboBox::OnKeyDown(nChar, nRepCnt, nFlags);