Auto-complete text field?

Will Sadkin wrote:

Robin Dunn wrote:

Jim Carroll wrote:

Hi, I want to do an auto-complete text field that is just
like the address bar in firefox. I tried the masked edit
controls, but they don't actually pop up the options in a
list box under the edit field. I could use a very small Scite
control...

But I'm wondering if anyone knows of an implementation
that uses a plain TextCtrl for auto-complete?

http://wiki.wxpython.org/index.cgi/TextCtrlAutoComplete

There was also some discussion about it on this list in February.

I had missed this discussion, and given that this seemed similar to
my own masked.ComboBox functionality, I went and tried the code above.

[...]
Another pair of enhancements would be to allow you to specify your
own "match" function, so that you could do fancy matching, the way
the address bar does, skipping boilerplate like http:, www, etc,
and an optional callback on each change to the text as typed, so
that you could set the control up to autogenerate a new choice list
based on what was typed so far as you typed, the way that the Firefox
address bar does-- this should be possible, and would be a wicked
cool demo too!

(I will think about doing these things if I ever find the time...)

Ok, I was having so much fun experimenting with this that I ended
up adding both of these things to the control defined in the
wiki, and updated the test code to demonstrate how to do dynamic
update of the control based on what's typed. (and it *is* a pretty
cool feature, as I suspected... :slight_smile:

(I also fixed a couple of other bugs re: sorting differences between
python default lexocographic sort, and the ListCtrl's sort, which is
case-insensitive, and I changed the case for the control's public
functions to be MixedCase like the rest of wx.Python.)

I think I'm done fiddling with this now, and I hope I've made this
control the better for it!

Regards,
/Will Sadkin
Author, lib.masked

Ok, I was having so much fun experimenting with this that I ended
up adding both of these things to the control defined in the
wiki, and updated the test code to demonstrate how to do dynamic
update of the control based on what's typed. (and it *is* a pretty
cool feature, as I suspected...

Very cool! It's behaving great now! I'll probably be adding one or
two more hooks for my database lookup & I'll update the wiki!

Thanks a bunch Will!
-Jim