[pygtk] 'live search' ComboBoxEntry
John Pye
john at curioussymbols.com
Sun Jan 6 14:54:21 WST 2008
Hi all
I'm looking to implement something a bit like the search box in Firefox,
where you get suggested text after typing a few letters.
Specifically, I have an application where I would like to use a
ComboBoxEntry which contains a fairly long list of options in its
ListStore. I would like to be able filter the list according to the
letters types into the Entry, so for example typing 'ac' would reduce
the big long list of words in the list down to just 'action' and
'acceleration' and maybe some others. Then typing an additional 'c'
would filter the list down to just one item, which would then
autocomplete. At any time, the user would be able to use the down arrow
to access suggested items on the list. Once a valid entry was selected,
the list would return to its unfiltered state.
I have had a go at implementing this type of behaviour here:
http://ascendcode.cheme.cmu.edu/viewvc.cgi/code/branches/extfn/pygtk/unitsdialog.py?revision=1937&view=markup
but so far it doesn't work as I would like: when the combobox pops up,
the keyboard focus is taken away from the Entry, which means it's rather
cumbersome to use.
Is this something that can be acheived with the standard ComboBoxEntry?
Has anyone got some same code for this sort of thing?
Any suggestions would be great.
Cheers
JP
More information about the pygtk
mailing list