MSpitters has asked for the wisdom of the Perl Monks concerning the following question:

Hi all, I already posed this question last week, but I didn't get any useful answers, so I guess the description of my problem wasn't quite clear enough. I'll try it again. I created a HList and wrote some drag 'n drop functionality around it: I can now pick something up (e.g. a file) and drag it to a folder somewhere else in the HList. However, when I want to drag something to a folder which is out of the HList's current view (because the HList is scrolled all the way down or something), the HList does not automatically scroll 'along' in the dragging direction (up or down). I hope someone can help me out with this problem, because my application is completely useless if I don't find a solution to this problem. I haven't been able to find this functionality in the Tk widget demo's. Sorry about my poor English, M
  • Comment on Perl/Tk: Drag 'n Drop in a HList: auto-scrolling

Replies are listed 'Best First'.
Re: Perl/Tk: Drag 'n Drop in a HList: auto-scrolling
by bbfu (Curate) on Sep 29, 2003 at 16:39 UTC

    Are you using Tk::DragDrop or implementing your own drag/drop methods? Where is the relevant parts of your code? What have to tried in attempting to get this to work?

    The following very simple test case seems to display the desired functionality to me:

    #!/usr/bin/winperl use warnings; use strict; use Tk; use Tk::HList; my $mw = MainWindow->new(); my $hl = $mw->Scrolled('HList', -itemtype => 'text', )->pack(); foreach(qw(Foo Bar Baz Quux Wibble Zod Beezel Narf Fobble)) { $hl->add($_, -text => $_); } MainLoop;

    When I run that, and click-and-drag the mouse, the list scrolls automatically. Therefore PodMaster's reply to your previous post was correct, in that this functionality appears to be built-in.

    It's entirely possible that your drag-and-drop code is somehow overriding the default behavior, probably by rebinding the Motion event. However, it's impossible to say for sure, since you don't post any of your code.

    If you would like further assistance, I recommend that you post a reduced test-case from your code that exhibits the problem you're trying to solve (see Ovid's excellent node Before You Post ...).

    bbfu
    Black flowers blossom
    Fearless on my breath