Re: Closing a window to trigger the 'delete_event' signal
- From: Francois Marier <francois nit ca>
- To: gtk-perl-list gnome org
- Subject: Re: Closing a window to trigger the 'delete_event' signal
- Date: Wed, 28 Jul 2004 19:44:06 -0400
On Thu, Jul 29, 2004 at 01:20:44AM +0200, Torsten Schoenfeld wrote:
Well, that approach actually does work for me:
my $w = Gtk2::Window -> new();
my $b = Gtk2::Button -> new("Quit");
$w -> signal_connect(delete_event => sub {
warn "No, I'm not going to go away.\n";
1;
});
$b -> signal_connect(clicked => sub {
$w -> signal_emit(delete_event => undef);
});
$w -> add($b);
$w -> show_all();
Gtk2 -> main();
When I run that code (with the "use Gtk2 '-init';" of course), I get
the following error:
*** unhandled exception in callback:
*** variable not allowed to be undef where GdkEvent is wanted at ./window-test line 14.
*** ignoring at ./window-test line 20.
(line 14 here is the signal_emit line)
signal_emit takes whatever arguments the event in question wants. In
this case, it's just the Gtk2::Gdk::Event object, which might well be
undef.
I'm not sure I understand what that object is supposed to be, that's
why I figured that I'd put "undef"...
Here's my version of gtk2-perl and all of its dependencies:
libatk1.0-0 1.6.1
libc6 2.3.2.ds1
libglib-perl 1.043
libglib2.0-0 2.4.4
libgtk2.0-0 2.4.4
libgtk2-perl 1.043
libpango1.0-0 1.4.0
perl 5.8.4
Francois
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]