How to create an MFC ComboBox with search

I need a combo box in a Windows MFC application that has a search function. It should work so that if you start to enter something that matches one or more items in the list, a drop-down menu and hang out these items. Kinda as popular ajax-based search boxes on the Internet

Do you need to know any control that provides this functionality? - Is there a link to information on how to create such functionality yourself? - Any ideas on how to do this, what could you share?

+4
source share
5 answers

Found the following:

http://www.codeguru.com/cpp/controls/combobox/article.php/c1807/

The renamed class, since CComboBoxEx is now part of MFC, and added the ShowDropDown () call to OnEditUpdate ().

+2
source

Provide a handler for the CBN_EDITCHANGE event, your handler will be called every time the user changes the text in the edit field.

In this handler, call the CComboBox::FindString() method to see if the entered text exists in any of your combobox entries. If so, call CComboBox::SetCurSel() to select it.

0
source

This is the Win32 api FAQ. See Adv. Win32 api ng news: //194.177.96.26/comp.os.ms-windows.programmer.win32 (you do not need CBN_EDITCHANGE at all, it is automatically with api)

0
source

Full access to the combo box edit window:

 CEdit *pEdit = (CEdit *)pComboBox->GetWindow(GW_CHILD); 
0
source

CEdit * pEdit = (CEdit *) pComboBox-> GetWindow (GW_CHILD);

Is it possible to access the ListBox part in a similar way? It is necessary to clear the contents of the list, for example. using ResetContent.

0
source

All Articles