Re: GTKCombo: autocomplete?



muppet wrote:


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

Right.
I'm ready to take on auto-completion again.
I've read the above page on GtkEntryCompletion.

What I understand ( and I know I'm mixing Perl and C stuff here ):

my $gtkcompletion = gtk_entry_completion_new ()
creates a new gtkcompletion object

my $gtkentry = $window->get_widget('my_entry');
gets hold of my gtkentry widget

gtk_entry_set_completion ($gtkentry, $gtkcompletion);
attaches the completion object to the entry object

What I can't figure, however, is:

a) How to pass the completion object a list of strings for the completion list
b) What the Perl equivalent of the above C functions are

Is there any documentation ( or examples ) yet on using the GtkEntryCompletion object from Perl?

Dan

--
Daniel Kasak
IT Developer
NUS Consulting Group
Level 5, 77 Pacific Highway
North Sydney, NSW, Australia 2060
T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989
email: dkasak nusconsulting com au
website: http://www.nusconsulting.com.au
Title: CanIt Vote for ID 44626

The following links have been placed here by the NUS Consulting internal spam filter and are for use by NUS Consulting staff only.
Please ingore these links.
Spam
Not spam
Forget previous vote


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