5,276,156 members and growing! (21,291 online)
Email Password   helpLost your password?
Desktop Development » Edit Controls » General     Intermediate

Auto-Completion Edit Control

By James R. Twine

An edit control that provides auto-completion functionality for small data sets.
VC6, C++Windows, NT4, Win2K, MFC, STL, VS6, VS, Dev

Posted: 21 Sep 2000
Updated: 16 Jul 2001
Views: 71,642
Announcements
Want a new Job?



Search    
Advanced Search
Sitemap
19 votes for this Article.
Popularity: 5.56 Rating: 4.35 out of 5
0 votes, 0.0%
1
0 votes, 0.0%
2
0 votes, 0.0%
3
2 votes, 40.0%
4
3 votes, 60.0%
5
  • 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 has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

    A list of licenses authors might use can be found here

    About the Author

    James R. Twine


    Mvp
    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(?):
    http://www.jrtwine.com
    http://www.jrtwine.com/jtwine
    http://www.signingtime.com
    http://www.deletefxpfiles.com
    http://www.checkfavorites.com
    http://www.coinop.org
    Occupation: President
    Company: JRTwine Software, LLC
    Location: United States United States

    Other popular Edit Controls articles:

    Article Top
    Sign Up to vote for this article
    You must Sign In to use this message board.
    FAQ FAQ Noise ToleranceSearch Search Messages 
     Layout  Per page   
     Msgs 1 to 10 of 10 (Total in Forum: 10) (Refresh)FirstPrevNext
    Subject  Author Date 
    GeneralConfusion with Multiple matchesmemberAndrew Phillips14:45 15 Jan '02  
    GeneralRe: Confusion with Multiple matchesmemberPJ Arends6:14 16 Jan '02  
    GeneralDemo fails to compile!sussKevin Gutteridge12:34 4 Oct '00  
    GeneralRe: Demo fails to compile!sussJames R. Twine10:10 6 Oct '00  
    GeneralRe: Demo fails to compile!memberAnonymous8:45 18 Jul '01  
    GeneralRe: Demo fails to compile!memberAnonymous8:45 18 Jul '01  
    GeneralAuto-Complete CombosussNot Chris Maunder9:13 26 Sep '00  
    GeneralRe: Auto-Complete CombosussJames R. Twine9:26 26 Sep '00  
    GeneralCase Sensitve?sussJames Curran 5:33 25 Sep '00  
    GeneralRe: Case Sensitve?sussJames R. Twine6:26 25 Sep '00  

    General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

    PermaLink | Privacy | Terms of Use
    Last Updated: 16 Jul 2001
    Editor: Chris Maunder
    Copyright 2000 by James R. Twine
    Everything else Copyright © CodeProject, 1999-2008
    Web18 | Advertise on the Code Project