Events and Signals



I want to ignore the "focus out event" when closing the window. How can I do it??

This code:


use Gtk2 '-init';
use Glib qw/TRUE FALSE/;

my $entry = Gtk2::Entry->new;
my $foe = $entry->signal_connect('focus_out_event' => sub{ print "focus out\n" });
my $window = Gtk2::Window->new('toplevel');
$window->signal_connect('destroy' => sub{ Glib::Source->remove($foe); print "destroy\n"; Gtk2->main_quit });

$window->add($entry);
$window->show_all;

Gtk2->main;
exit 0;


Not working, because "focus out" is called first than "destroy".

Thanx.



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