Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: MFC combobox UI
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 10-Apr-10 5:27am
Edited 28-May-10 2:27am
Moak11.4K
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Refer to this[^] article.
 
The control presented in the article covers all of your requirements and supports both CEdit and CComboBox. Smile | :)
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Ref. to this article, it might help you out:
 
http://www.codeguru.com/cpp/controls/combobox/article.php/c4951[^]
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

I myself had used the same technique. MFC doesn't provide any ready made functions.
  Permalink  

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

  Print Answers RSS
0 Maciej Los 295
1 OriginalGriff 249
2 Sergey Alexandrovich Kryukov 205
3 Aajmot Sk 197
4 Sinisa Hajnal 176
0 OriginalGriff 7,800
1 Sergey Alexandrovich Kryukov 7,072
2 DamithSL 5,604
3 Manas Bhardwaj 4,986
4 Maciej Los 4,790


Advertise | Privacy | Mobile
Web04 | 2.8.1411023.1 | Last Updated 6 Jun 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100