Hi All, Am trying to connect to events again and this time in a Gtk2::EntryCompletion. I have borrowed some of the code from: http://www.koders.com/perl/fidB8CEA21DDF39929C30B4914E5CD897D03858890E.aspx?s=gtk2#L14 Below is what I have so far: #!/usr/bin/perl package main; use strict; use Gtk2 -init; # Read in glade file with gui my $builder = Gtk2::Builder->new; $builder->add_from_file("EntryCompletion.glade"); my $main_window; my $entry; # Create the completion object my $completion = Gtk2::EntryCompletion->new; # Assign the completion to the entry $entry->set_completion ($completion); # Create a tree model and use it as the completion model $completion->set_model (create_completion_model ()); # Use model column 0 as the text column $completion->set_text_column (0); &connect_signals; # Maximise window #$main_window->maximize; # Run main loop. Gtk2->main; sub retrieve_widgets { # Get Widgets from gui file $main_window = $builder->get_object('window1') || die "Can't find window.\n"; $entry = $builder->get_object('entry1') || die "Can't find window.\n"; } sub connect_signals { # Quit when user clicks on the close button/alt-f4 etc. $main_window->signal_connect (destroy => sub { Gtk2->main_quit; }); $completion->signal_connect('cursor-on-match' => sub { print("Cursor on Match\n"); }); } # Creates a tree model containing the completions sub create_completion_model { my $store = Gtk2::ListStore->new (Glib::String::); # Append one word $store->set ($store->append, 0, "GNOME"); # Append another word $store->set ($store->append, 0, "total"); # And another word $store->set ($store->append, 0, "totally"); return $store; } I'm just trying to get the cursor-on-match event to trigger my print statement. I was under the impression that the following would trigger the event: 1. In the entry field type 'to' (without the quotes). 2. This brings up the EntryCompletion and shows 'total' and 'totally' 3. Using the up and down arrow keys you can highlight the possible matches. - At this point as I moved the selection up and down I thought this would trigger the 'cursor-on-match' event. However I'm not getting anything printed to my screen. Is someone able to tell me how I match this event? Have attached the glade file if that helps.
Attachment:
EntryCompletion.glade
Description: Binary data