label with context menu (populate-popup)



Is there an easy way to get a context menu on a label?
According to the documentation, it should support a
'populate-popup' signal, so it looks like this should be
painless. If I try the following (which works fine on other
occasions):

$label->signal_connect('populate-popup',
     sub {
             warn "populate";
              my ($widget, $mnu ) = @_;
              my $item=Gtk2::MenuItem->new('Show Latin');
              $item->signal_connect_after('activate',
                         sub {warn "do something ...";});
              $mnu->append($item);
              $item->show();
      });

I get no warning, only the signal is never triggered.
The documentation for GtkLabel doesn't say when this
signal occurs, I just assumed it would be triggered
whith the right mouse button...

Regards,
                   Peter Daum




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