Re: Gtk3 context menu



26.08.2014, 04:12, "Daniel Kasak" <d j kasak dk 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 :)

Attachment: menu.pl
Description: Text Data



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