Re: other click than right



mvillers apkala com (Mickael VILLERS) wrote:

Lo, 
I've search how to receive event for others mouse
click than right but I didn't found
My objective is to open a box when I left-click on one
of the node of a CTree

I have steel $ctree->signal_connect( 'select_row', \&selection_made );
which works fine for the right-click

I think this should work:

  $ctree->signal_connect('button_press_event', sub {
    my ($widget, $event) = @_;

    # this maps the click coordinate to clist row/column
    my ($row, $column) = $widget->get_selection_info( $event->{x}, $event->{y} );

    # which button was pressed?
    if ( $event->{button} == 1 ) {
      # left button

    } elsif ( $event->{button} == 3 ) {
      # right button
    }
  } );

Regards,

Joern

-- 
sub i($){print$_[0]}*j=*ENV;sub w($){sleep$_[0]}sub _($){i"$p$c > ",w
1,$_=$_[0],tr;i-za-h,;a-hi-z ;,i$_,w 1,i"\n"}$|=1;$f='HO';($c=$j{PWD}
)=~s/$j{$f."ME"}/~/;$p="$j{USER}\ $j{HOSTNAME}:";_"kl",$c='~',_"zu,".
"-zn,*",_"#,epg,lw,gwc,mfmkcbm,cvsvwev,uiqt,kwvbmvb?",i"$p$c > ";w 99



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