#!/usr/bin/winperl use warnings; use strict; use Tk; use Tk::Tree; my $mw = MainWindow->new(); my $tr = $mw->Tree( -command => sub { print "Tree::command\n" }, )->pack(); $tr->add($_, -text => $_) for qw(Foo Bar Quux); $tr->addchild('Foo', -text => 'Zod'); $tr->autosetmode(); # Replace normal double-click handler with our special routine { my $old = $mw->bind('Tk::Tree', ''); $mw->bind('Tk::Tree', '', [ \&invoke, Ev('x'), Ev('y'), $old, ]); } MainLoop; sub invoke { my ($tree, $x, $y, $old) = @_; # Get info about what item was clicked on my ($entry, $subitem) = $tree->info('item', $x, $y); if(defined($subitem) and $subitem eq 'indicator') { #return; # ignore, if you want # Indicator, so just open/close the entry $tree->IndicatorCmd($entry, ''); } else { # Not indicator, so propagate #$tree->Double1(); # Don't do this $old->Call($tree); # Instead, use old callback } }