Click here to Skip to main content
15,881,413 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I need to create a combo box which provides the auto search feature to a user. Its should behave just like the combo box which we see in the Windows 'Run' dialog or in the windows search dialog. So, as the user types in characters , all the matching strings in the combo box list must be displayed.

MY idea for doing this is as follows:

1> Get notified every time the user edits the combo edit box.
2> In the edit handler, get the text in the combobox.
3> Then search through all entries in the combo box list and build a vector of matching entries in the list.
4> Create a list box populated with the strings in the vector and display it (properly aligned with the combo box).

Is there a simpler way of doing this or does MFC provide a simpler way or any ready made functions which can accomplish all the tasks mentioned in the steps above? Some sample code or links will be helpful.
Posted
Updated 28-May-10 1:27am
v2

Refer to this[^] article.

The control presented in the article covers all of your requirements and supports both CEdit and CComboBox. :)
 
Share this answer
 
v2
Ref. to this article, it might help you out:

http://www.codeguru.com/cpp/controls/combobox/article.php/c4951[^]
 
Share this answer
 
I myself had used the same technique. MFC doesn't provide any ready made functions.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900