[pygtk] gtk.ComboBoxEntry and "changed" event on keystrokes.
Neil Dugan
pygtk at butterflystitches.com.au
Tue Mar 30 23:11:49 WST 2010
Osmo Maatta wrote:
> Hello,
>
> I have a small application that has a search-field (gtk.ComboBoxEntry)
> and a button to start a search job.
>
> The application will start a new search if user:
> 1) Selects an item from the gtk.ComboBoxEntry's drop-down list.
> This is handled by gtk.ComboBoxEntry's "changed" event. This is Ok.
>
> 2 Types a search query (some text) and presses the [Start search] button.
> This is handled by the button's "clicked" event. This is Ok.
>
> 3) Presses the [Enter]-key.
> This is handled by the combo's "activate" event attached to the
> gtk.Entry. This is Ok.
>
> Because a search-job can take quite a long time, I do not want to
> activate search for each keystroke, when user types text in the search
> field. And this is my problem. Key-strokes activate the "changed" event
> on the gtk.ComboBoxEntry field. I cannot distinguish between the
> drop-down list's "changed" event (which I want) and the "changed" event
> when user types text (I try to avoid this event).
>
> User is welcome to type in some text/query and press the [Start search]
> button. This is OK.
>
> So how to avoid "changed" event on each keystroke?
>
> A simplified but complete example: http://www.futuredesktop.com/tmp/w4.py
>
> Happy Easter,
> Moma Antero
> Grønland
>
>
>
I couldn't find a direct way of handling the problem..
But how about a timeout that only occurs after the user stops typing
for a while (e.g. 1/2 a second). It stops the search being triggered
for every keystroke.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: w4.py
Type: text/x-python
Size: 2114 bytes
Desc: not available
Url : http://www.daa.com.au/pipermail/pygtk/attachments/20100331/62b016b2/attachment.py
More information about the pygtk
mailing list