That's it! Thanks :) I wonder if this ( the menu being destroyed after $menu goes out of scope ) is the correct behaviour. Certainly other gtk widgets don't behave like this, but I guess I'm mainly thinking about widgets that are added to a window. A menu isn't like that. Is that why $menu has to remain in scope?
Dan On Tue, Aug 26, 2014 at 4:04 PM, Yuri Myasoedov <ymyasoe...@yandex.ru> wrote: > 26.08.2014, 04:12, "Daniel Kasak" <d.j.kasak...@gmail.com>: > > I've tried the above fix, but things are still not good. I've uploaded a > simple demo to: > > http://tesla.duckdns.org/downloads/menu.pl ( pasting stuff in gmail > always mangles things ). > > > > $event is still morphing from a Gtk3::Gdk::EventButton to a > Gtk3::Gdk::Event, which is giving: > > > > *** unhandled exception in callback: > > *** Can't locate object method "time" via package "Gtk3::Gdk::Event" > at menu.pl line 66. > > *** ignoring at /usr/local/lib64/perl5/5.16.3/Gtk3.pm line 318. > > > > Frankly, I can work around this. What's annoying me most at the moment > is that the menu doesn't pop up. Can anyone see why I can't get a menu? > > Try attached version. > > $menu is a local variable, it is destroyed in Gtk3 right after popup. > You can either use global "our $menu" or create "my $menu" outside > subroutines and > pass it to 'button_press_event' callback: > > $treeview->signal_connect( button_press_event => sub { on_tree_click( @_, > $menu ) } ); > > I don't know why $menu is not destroyed in Gtk2 :) > _______________________________________________ > gtk-perl-list mailing list > gtk-perl-list@gnome.org > https://mail.gnome.org/mailman/listinfo/gtk-perl-list > >
_______________________________________________ gtk-perl-list mailing list gtk-perl-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-perl-list