Greeting esteemed monks,
I'm trying to set a popup menu in a Gtk2::TreeView which can have different menu choices depending on the type of information in the row selected by the user.
The first time selecting the popup menu is fine according to the data it sees. The next time I select a row with data that requires a different popup it continues to show the old popup in addition to the new one.
I just can't seem to clear the menu.
Any ideas?
Code snippet
sub popup { my $menu; if ($type eq 'type1') { $menu = Gtk2::Menu->new(); my $menu_item = Gtk2::MenuItem->('Properties'); $menu_item->signal_connect(activate => sub { # do something }); $menu->append($menu_item); }elsif ($type eq 'type2') { $menu = Gtk2::Menu->new(); my $menu_item = Gtk2::MenuItem->('View'); $menu_item->signal_connect(activate => sub { # do something else }); $menu->append($menu_item); } $simple_list =>signal_connect('button-press-event' => sub { my ($widget, $event) = @_; return FALSE unless $event->button eq 3; $menu->popup ( undef, undef, undef, undef, $event->button, $event->time); } $menu->show_all; }
In reply to TreeView popup issue by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |