Re: pop menu with a right-click in a gtktreeview
- From: anguila <anguila gmail com>
- To: muppet <scott asofyet org>
- Cc: gtk-perl-list gnome org
- Subject: Re: pop menu with a right-click in a gtktreeview
- Date: Wed, 25 Jun 2008 15:22:05 +0200
so the point is catching the destroy signal and return 0? Can I reuse the gtkmenu widget created by glade? It's compulsory create the widget in the signal sub as you do here?
The last code, it works at the first time, maybe returing 0 at the destroy signal it works, i'll try later...
thanks anyway :)
On Wed, Jun 25, 2008 at 3:08 PM, muppet <
scott asofyet org> wrote:
anguila wrote:
> create a fresh? destroy an create again the widget?
gtk_menu_popup() consumes the menu widget (that is, calls destroy on it) for
itself. Click in this window and watch when the lolcat complains on stdout:
#!/usr/bin/perl
use strict;
use warnings;
use Gtk2 -init;
my $window = Gtk2::Window->new;
$window->add_events (['button-press-mask', 'button-release-mask']);
$window->signal_connect (button_release_event => \&do_menu);
$window->signal_connect (destroy => sub { Gtk2->main_quit });
$window->show;
Gtk2->main;
sub do_menu {
my ($widget, $event) = @_;
my $menu = Gtk2::Menu->new;
$menu->signal_connect (destroy => sub {
print "halp, i'z bein destroyeded!\n";
return 0;
});
my $item = Gtk2::MenuItem->new ("Cheezburger");
$menu->append ($item);
$item->show;
$menu->popup (undef, undef, undef, undef, $event->button, $event->time);
# $menu will be destroyed when the user quits interacting with it.
return 0;
}
__END__
--
muppet <scott at asofyet dot org>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]