Re: Simplelist signals



On Thu, 2003-11-27 at 16:59, David Sword wrote:

I would really like to call a callback when a row in a SimpleList is
clicked, just like when a row is selected in a Combo.  

If you just want to be notified when the selection changed, use the
"changed" signal of the GtkTreeSelection object associated with the
SimpleList:

  $simple_list -> get_selection() -> signal_connect(changed => sub {
    my ($selection) = @_;
    # ...
  });

If you want to receive all click events, use "button_press_event" or
"button_release_event":

  $simple_list -> signal_connect(button_press_event => sub {
    my ($view, $event) = @_;

    if ($event -> button == 1) { # first mouse button
      # ...
      return 0; # we handled the event
    }

    return 1; # we didn't handle the event
  });

HTH,
-Torsten




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