blackadder has asked for the wisdom of the Perl Monks concerning the following question:
Many thanks in advance….use Tk; use strict; use Tk::Text; use Tk::Frame; use Tk::DirTree; use Tk::Adjuster; use Tk::Scrollbar; my $mw = new MainWindow; $mw->geometry('500x600'); my $left_frame = $mw->Frame; my $right_frame = $mw->Frame; my $dir_label = $mw->Label(-text => 'Path :'); my $dir_name = $mw->Entry(-width => 30, -textvariable => \ my $variabl +e); my $adjuster = $mw->Adjuster(-widget=>$left_frame, -side=>'left'); my $list_box = $left_frame->Scrolled('DirTree', -height=>'0', -width=> +'0', -scrollbars =>'e',); my $output_text = $right_frame->Scrolled('Text', -height=>'1', -width= +>'1', -scrollbars=>'osoe',); $top_frame->pack(qw/-side top/); ####Errors occure in this '#' enclosed section####################### $list_box->bind('<ButtonRelease-1>', sub {my $indx = $list_box->cursel +ection(); my $selected_object = $list_box->get($indx);}); $list_box->bind('<ButtonRelease-2>', sub{print “\nuser clicked twice”; +}); ##################################################################### $dir_label->pack (qw/-side top -anchor w/); $dir_name->pack (qw/-side top -anchor e/); $left_frame->pack(qw/-side left -fill y/); $adjuster->pack(qw/-side left -fill y/); $right_frame->pack(qw/-side right -fill both -expand 1/); $list_box->pack(qw/-side left -fill both -expand 1/); $output_text->pack(qw/-side bottom -fill both -expand 1/); MainLoop; exit();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Binding mouse clicks in perl/Tk
by Abigail-II (Bishop) on Jul 19, 2002 at 17:12 UTC | |
by blackadder (Hermit) on Jul 19, 2002 at 22:36 UTC | |
|
Re: Binding mouse clicks in perl/Tk
by ichimunki (Priest) on Jul 19, 2002 at 17:03 UTC |