tos has asked for the wisdom of the Perl Monks concerning the following question:
currently i'm working on a pTk-application which i will use for sorting pictures by hand. Some experiments with hlist worked quite good with single-selections. But i want a really ergonomic behavior as f. i. in KDE's konqueror or in ms-explorer.
I would like to select one or more eventually disjointed items (=thumbnails) as i can do already in a Listbox with -selectmode => "extended". Then i want to grip this selection, drag it and drop it onto another entry in the same Listbox/HList-entry. The selection should then be moved before this destination entry.
My problem is that a new ButtonPress-1-event destroys the former selection. In the documentation i couldn't find anything which avoids this behavior.
example which illustrates the problem
Any hints or suggestions ?use strict; use Tk; my $main = MainWindow->new; my $box = $main->Listbox(-relief => 'sunken', -width => -1, # Shrink to fit -selectmode => "extended", -height => 5, -setgrid => 1); my @items = qw(One Two Three Four Five Six Seven Eight Nine Ten Eleven Twelve); foreach (@items) { $box->insert('end', $_); } my $scroll = $main->Scrollbar(-command => ['yview', $box]); $box->configure(-yscrollcommand => ['set', $scroll]); $box->pack(-side => 'left', -fill => 'both', -expand => 1); $scroll->pack(-side => 'right', -fill => 'y'); MainLoop;
(btw. PMs is really very cool)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: move extended selections within TK::HList or Tk::Listbox
by paulbort (Hermit) on May 22, 2003 at 15:15 UTC | |
|
Re: move extended selections within TK::HList or Tk::Listbox
by JamesNC (Chaplain) on May 22, 2003 at 13:30 UTC | |
|
Re: move extended selections within TK::HList or Tk::Listbox
by bobn (Chaplain) on May 22, 2003 at 13:27 UTC | |
by tos (Deacon) on May 22, 2003 at 14:40 UTC | |
by PodMaster (Abbot) on May 23, 2003 at 09:53 UTC |