Here is a fancy version I gleamed from the usenet, which uses drag'n'drop. Select A and D, then drag one to the yellow area. I think it's close to what you want. Just substitute your filenames for A..Z.
#!/usr/bin/perl use Tk; use Tk::DragDrop; use Tk::DropSite; use strict; my $var; my $curindex; my $mw=tkinit; my $listframe = $mw->Scrolled( 'Listbox', -selectmode=>'multiple', -scrollbars=>'oe')->pack; my $listbox = $listframe->Subwidget('scrolled'); $mw->Label(-text=>'Yellow Entry is the DropSite')->pack; my $entry = $mw->Entry(-bg=>'yellow')->pack; $listframe->insert('end',('A'..'Z')); my $token = $listbox->DragDrop( -event => '<B1-Motion>', -sitetypes => [qw/Local/], -startcommand=>\&draghandler, ); $entry->DropSite( -droptypes => [qw/Local/], -dropcommand => [\&fillEntry,$entry,$listbox], ); $listbox->bind('<ButtonPress-1>',sub { my $e=$listbox->XEvent; $curindex=$listbox->nearest($e->y); }); MainLoop; sub draghandler { #Force selection of the index under the mouse $listbox->selectionSet($curindex,$curindex); } sub fillEntry { my ($e,$l)=@_; $var=''; $e->delete(0,'end'); foreach ($l->curselection){ $var=$var.$l->get($_); } $e->insert('end',$var); $l->selectionClear(0,'end'); } __END__
In reply to Re: The right Tk file selecter
by zentara
in thread The right Tk file selecter
by etcshadow
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |