Re: GTKCombo: autocomplete?




On Thursday, May 13, 2004, at 05:50 AM, Jan Hudec wrote:

On Thu, May 13, 2004 at 14:09:18 +1000, Daniel Kasak wrote:
I realise that this is not strictly a PerlGTK questions, but maybe someone knows anyway. I've got a GTKCombo box that I'm loading data into with $mycombo->set_popdown_strings(@list_of_companies). The combo box will contain a list of all of our clients - it's a pretty large list. Is it possible to have the combo box seek the closest match to what you type in the entry box ( yeah, like Access ).
...
Yes, you can. The GtkCombo contains a GtkEntry and GtkEntry has 'insert-text' and 'delete-text' signals. There are also some facilities in Gtk to do completions, which should be faster than regexps (after all, C is still faster than perl). Actualy, it should be filed as Gtk bug if GtkCombo does not do autocompletion automaticaly.

well, you could file a missing feature bug on GtkCombo, but it would be ignored -- GtkCombo is deprecated as of gtk+ 2.4.0, in favor of GtkComboBox.

in gtk+ 2.4, there are new object that will make it easier to do what you (Daniel) are talking about --- GtkComboBox sucks less than GtkCombo, and GtkEntry now has a helper object called GtkEntryCompletion, which, oddly enough, does text completion.

http://developer.gnome.org/doc/API/2.0/gtk/GtkEntryCompletion.html


you will need gtk+ 2.4 (comes with Gnome 2.6) and Gtk2 > 1.04 to use these new objects.


--
She's obviously your child. She looks like you, she talks a lot, and most of it is gibberish.
  -- Elysse, to me, of Zella.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]