Click here to Skip to main content
13,771,078 members
Click here to Skip to main content
Add your own
alternative version


47 bookmarked
Posted 21 Sep 2000
Licenced CPOL

Auto-Completion Edit Control

, 16 Jul 2001
Rate this:
Please Sign up or sign in to vote.
An edit control that provides auto-completion functionality for small data sets.
  • Download demo project - 19 Kb
  • Download source - 4 Kb

    This article describes a class (CACEditCtrl) for an Auto-Completion Edit Control, which can be used small data sets, such as most-recently-used account numbers, etc.

    It works by iterating over a collection of STL strings and tries to find a matching beginning-substring in the entry. It is not the most the most effecient way of doing it, but it works well for small data sets.

    The two functions of interest are:

    • void AddACEntry( LPCTSTR cpEntry )
    • void DisableAC( bool bDisable = true )

    The AddACEntry(...) function is used to add a string to the control's collection of strings. No duplicate checking is done. Why? Because this control acts as a container for data, not a manager of data.

    The DisableAC(...) function allows you to turn the Auto-Completion feature on or off.

    In the demo image above, the numbered dialogs show the operation of the control as 3 characters are typed into it :"T", "h", and "a" as shown below:

    1. No characters typed
    2. A "T" was typed into the control, and it auto-completed with its first match
    3. A "h" was typed into the control, ditto above
    4. An "a" was typed into the control, and there were no matches to auto-complete for

    Conditions of use are detailed in the header and source file(s).

    Feel free to contact me if there are any questions. Have fun.

  • License

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


    About the Author

    James R. Twine
    President JRTwine Software, LLC
    United States United States
    Programming since the age of 10, started professionally at the age of 17. Currently involved in both Client and Server side development on Win32 platforms for MC/HA/FT financial applications. Development experience with Win32, Win16, Linux and other flavors of Unix.

    Extensive multithreaded development experience on Windows platforms using the Win32 SDK, and MFC.

    Experience with HA/FT n-tiered Client/Server systems as well as GUI apps of varying complexity. Some experience with Game developement.

    Having learned that the stuff you can barely get away with doing Client-side apps just does not cut it in the real "Server World", I am amazed how many 'professionals' cannot tell the difference between "works" and "correct" or try to (mis)use VB and/or MFC on server-side development projects, never considering that just because it RUNS, does not mean it runs WELL.

    Lastly, I am also a collector of arcade games, and can perform repairs, conversions, etc. Search for my name, you will find me on lots of arcade-related documents and sites.

    Sites of interest(?):

    You may also be interested in...


    Comments and Discussions

    Generalthere is a bug when use with muliline style Pin
    hjingle15-Oct-08 22:45
    memberhjingle15-Oct-08 22:45 
    QuestionGreat Work Pin
    narkotic_ro16-Sep-08 11:12
    membernarkotic_ro16-Sep-08 11:12 
    AnswerRe: Great Work Pin
    James R. Twine16-Sep-08 11:58
    memberJames R. Twine16-Sep-08 11:58 
    GeneralConfusion with Multiple matches Pin
    Andrew Phillips15-Jan-02 14:45
    memberAndrew Phillips15-Jan-02 14:45 
    GeneralRe: Confusion with Multiple matches Pin
    PJ Arends16-Jan-02 6:14
    professionalPJ Arends16-Jan-02 6:14 
    GeneralDemo fails to compile! Pin
    Kevin Gutteridge4-Oct-00 12:34
    memberKevin Gutteridge4-Oct-00 12:34 
    GeneralRe: Demo fails to compile! Pin
    James R. Twine6-Oct-00 10:10
    memberJames R. Twine6-Oct-00 10:10 
    GeneralRe: Demo fails to compile! Pin
    18-Jul-01 8:45
    suss18-Jul-01 8:45 
    GeneralRe: Demo fails to compile! Pin
    18-Jul-01 8:45
    suss18-Jul-01 8:45 
    GeneralAuto-Complete Combo Pin
    Not Chris Maunder26-Sep-00 9:13
    sussNot Chris Maunder26-Sep-00 9:13 
    GeneralRe: Auto-Complete Combo Pin
    James R. Twine26-Sep-00 9:26
    memberJames R. Twine26-Sep-00 9:26 
    QuestionCase Sensitve? Pin
    James Curran25-Sep-00 5:33
    memberJames Curran25-Sep-00 5:33 
    AnswerRe: Case Sensitve? Pin
    James R. Twine25-Sep-00 6:26
    memberJames R. Twine25-Sep-00 6:26 

    General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

    Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

    Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
    Web01-2016 | 2.8.181119.1 | Last Updated 17 Jul 2001
    Article Copyright 2000 by James R. Twine
    Everything else Copyright © CodeProject, 1999-2018
    Layout: fixed | fluid