From 8b400366374508c7eda20ce0b16814bafb9be7b5 Mon Sep 17 00:00:00 2001 From: etienne Date: Thu, 8 Aug 2002 16:19:46 +0000 Subject: Les interactions dans le widget Tree sont identiques a celles sur les boutons ItemId : on peut utiliser les 3 boutons de la souris. --- Perl/Zinc/Debug.pm | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) (limited to 'Perl/Zinc/Debug.pm') diff --git a/Perl/Zinc/Debug.pm b/Perl/Zinc/Debug.pm index 49b0835..64c155e 100644 --- a/Perl/Zinc/Debug.pm +++ b/Perl/Zinc/Debug.pm @@ -13,6 +13,7 @@ use vars qw(@ISA @EXPORT); use Carp; require Exporter; use File::Basename; +use Tk; use Tk::Zinc; use Tk::LabFrame; use Tk::Pane; @@ -230,12 +231,33 @@ sub showtree { &showresult("", $zinc, $item); }, ); - $tree->configure(-browsecmd => sub { my $path = shift; - my $item = (split(/\./, $path))[-1]; - &surrounditem($zinc, $item); - }, - ); - + $tree->bind('<1>', [sub { + my $path = $tree->nearest($_[1]); + my $item = (split(/\./, $path))[-1]; + &highlightitem($tree, $zinc, $item, 0); + + }, Ev('y')]); + + $tree->bind('<2>', [sub { + my $path = $tree->nearest($_[1]); + $tree->selectionClear; + $tree->selectionSet($path); + $tree->anchorSet($path); + my $item = (split(/\./, $path))[-1]; + &highlightitem($tree, $zinc, $item, 1); + + }, Ev('y')]); + + $tree->bind('<3>', [sub { + my $path = $tree->nearest($_[1]); + $tree->selectionClear; + $tree->selectionSet($path); + $tree->anchorSet($path); + my $item = (split(/\./, $path))[-1]; + &highlightitem($tree, $zinc, $item, 2); + + }, Ev('y')]); + $tree->pack(-padx => 10, -pady => 10, -ipadx => 10, -fill => 'both', -- cgit v1.1