Yo, autocomplete.

Posted by – October 9, 2011

One of my biggest pet peeves is ‘AutoComplete’: the functionality of a text box to suggest (and complete) previously entered data. I’ve seen many bad implementations and the one fresh out of memory I can remember is Opera’s URL box, which I’ve mentioned a many times.

For RoundAbout, I implemented the AutoComplete in the ‘MailProperties’ box (see image above and video right here): The code can be found around this url, look for the method Memo3KeyUp). If I look at the code now (and to be honest, I’m hardly a Delphi programmer these days), I have no idea what I was doing: I recall that in some conditions the Autocomplete should stop doing its thing most notably when the user uses the navigational keys. Additionally, the partial matching was troublesome at one time also. What surprised me most was that everything could be implemented in one event (The KeyUP event of that particular memo box). Messy.

Eventually, I grew up and when there was a request to make an autocompleting editable combobox, I was smart enough to clean up the code and section it off in several methods (KeyUp/KeyDown and OnChange). This code end up living in its own component (PMComboBox): the code is so clean that I’m certain you should be able to take this code and rewrite it in other Windows-based programming languages.

Closed