Popup (context) menu behavior is strange



I've got a CTree for which I have context menu attached to right click
events. It works perfectly fine, except that you must hold the mouse
button down in order to select second or later menu items. If you simply
right click and release, it selects the first menu item immediately
rather than just displaying the menu. 

Anyone have a suggestion on how to fix this? I noticed that 
Stephen Wilhelm's tutorial exhibits similar behavior with the 'menu'
example application.

Here's the relevant code:

sub _prepare_buddy_menu {
  my $self = shift;

  my $menu = $self->{_window}->{buddy_menu} = new Gtk::Menu;
  $menu->set_tearoff_state(0);

  my @items =
    (
     ["Chat" => sub { $self->connect_buddy() }],
     ["Edit" => sub { $self->edit_buddy() } ],
     ["Remove" => sub { $self->_remove_buddy_dialog() } ],
     ["Info" => sub { $self->_buddy_info_dialog() } ],
    );

  foreach my $rec (@items) {
    my ($name, $callback) = @{$rec};
    my $menu_item = Gtk::MenuItem->new($name);
    $menu_item->signal_connect('activate', $self->$callback);
    $menu->append($menu_item);
    $menu_item->show();
  }
}

Thanks.

-- 

Steve Fox
http://k-lug.org



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