Hi Monks,

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

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;
Any hints or suggestions ?

(btw. PMs is really very cool)


In reply to move extended selections within TK::HList or Tk::Listbox by tos

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.