Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: X Error in Tk remote drag and drop

by Marshall (Canon)
on May 27, 2016 at 14:45 UTC ( [id://1164316]=note: print w/replies, xml ) Need Help??


in reply to X Error in Tk remote drag and drop

I made a few mods to get this working on Win32.
On my machine, the use statement required me to specify Win32, there might be some other incantation required on Linux? I also added -text so I could see something to drop onto. Then I took out the -droptypes. There appears to be something wrong with that.

So, the below does work on my Win32 box. Hopefully this will provide a few clues for your Linux problem.

#!/usr/bin/perl use strict; use Tk; use Tk::DropSite qw(Win32); my $mw = new MainWindow(-width => 500, -height => 300); my $label = $mw->Label(-text => "this is test")->pack->place(-relwidth + => 1.0, -relheight => 1.0); #$label->DropSite(-droptypes => ['XDND'], -dropcommand => [\&dropFile, + $label]); $label->DropSite( -dropcommand => [\&dropFile, $label]); MainLoop; sub dropFile { print "DROP\n"; }
Update: I am using Perl 5.22, Active State on Win XP. Tk and DropSite come in the standard dist, so I didn't have to install anything. Sorry I can't be of more help as I have no Linux to test on.
I did find this article drag n drop primer. It says: "Note: Perl/Tk supports Sun, XDND, KDE, and Win32 remote DND protocols". I suppose this is why I had to add qw(Win32) to the use statement. Could be that what you need is "XDND"? Not sure, but an idea.

Replies are listed 'Best First'.
Re^2: X Error in Tk remote drag and drop
by Anonymous Monk on May 29, 2016 at 16:39 UTC

    On Windows, there is no problem : if I replace 'XDND' by 'Win32' in the -droptypes option, this code is fully operational.

    The error appears only on Linux.

    Does anybody can try to test this code on a Linux box ?

    I have tested it on Linux Mint which is based on Ubuntu packages.

      I think perhaps we should be clear on what "fully operational" means?

      For me, when I select a file (left click) and drag, the icon should be the "ok, got it", then as mouse moves into the Tk box, it should change to the "no, you cannot drop here icon, the circle surrounding a backslash. If and only if you "find" the label should the icon change back to "ok,got it, you can drop here". If you do not find the label, then the result on my machine is "no error, and no action". That is the reason that I added -text to the label, so I could find it.

      Some of the incantations that I have tried seem inconsistent for reasons that I do not understand, even on Windows. Some of my tests say, OK, you can drop this file anywhere within this Main Window! I reboot the machine and run some intermediate cases and then all of a sudden something different happens.

      I did note the Xwindows error that you are getting. I am wondering if you are seeing the icon behavior that I expect in paragraph one above? It is hard for me to see how you would see that given that this label didn't have any "text" associated with it. I couldn't find the darn thing, because without text it is "invisible".

      My suspicion and testing results seem to indicate that there is something "flaky" here that also appears on Windows. Although I cannot test on Linux, there appears to be something very odd going on which can be hard to reproduce.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1164316]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (9)
As of 2024-04-18 09:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found