Re: more questions :)



On Thu, 2002-05-09 at 14:21, Gavin Jefferies wrote:

Hi Lanzz,

2. how can i connect to signals on CList rows or cells? i need to do something
on doubleclick on a row/cell, but i cannot get any widget for a row or a cell.
judging from C headers, a cell should be able to be of type GTK_CELL_WIDGET,
but i could not find any way to set it to a widget, even from C.

I seem to remember some discussion on this on the list
recently. However what I do (more or less) is:

sub displayEvent {
  my $list = shift;
  my $event = shift;
  ...

  if ($event->{'type'} eq '2button_press') {
    (my $row, my $col) = $list->get_selection_info($event->{'x'}, $event->{'y'});
    ...
  }
}

$list->signal_connect('key_press_event', \&displayEvent);

This tells me where it happened and I can work from there.

Gavin
--
http://emptytreeseedy.sf.net/


I like to use $ev->{button} == 1 to insure that the double click was a
left mouse button double click.

sub select_data {
        my ($clist, $ev) = @_;

        if ($ev->{button} == 1 and $ev->{type} eq '2button_press') {
                my ($row, $col) =
                        $clist->get_selection_info($ev->{x},$ev->{y});
                #do stuff with that row/column.
        }
}


-- 
Today is Prickle-Prickle the 56th day of Discord in the YOLD 3168
Or not.

Missile Address: 33:48:3.521N  84:23:34.786W




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