Thread Tk Drag&Drop aus Webbrowser (3 answers)
Opened by Strat at 2007-11-15 00:33

Strat
 2007-11-15 00:33
#102427 #102427
User since
2003-08-04
5246 Artikel
ModeratorIn
[Homepage] [default_avatar]
Hallo Leute,

wenn ich folgendes Script verwende, kann ich auf die Listbox lokale Dateien ziehen, und es funktioniert:
Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/local/bin/perl
use strict;
use warnings;

use Tk;
use Tk::DropSite;
use strict;
use vars qw($top $drop);

$top = new MainWindow;
$top->Label(-text => "The drop area:")->pack;
$drop = $top->Scrolled('Listbox',
                       -scrollbars => "osoe",
                       )->pack;
# Tell Tk that $drop should accept drops.
# The allowed drag and drop types on Unix systems are "KDE", "XDND" and "SUN"
# and on Windows systems the "Win32" dnd type.
# When dropping occurs, execute the accept_drop callback.
$drop->DropSite
    (-dropcommand => [\&accept_drop, $drop],
     -droptypes => ($^O eq 'MSWin32' ? 'Win32' : ['KDE', 'XDND', 'Sun'])
     );
MainLoop;

sub accept_drop {
    my($widget, $selection) = @_;

    my $filename;
    eval {
        if ($^O eq 'MSWin32') {
            $filename = $widget->SelectionGet(-selection => $selection,
                                              'STRING');
        } else {
            $filename = $widget->SelectionGet(-selection => $selection,
                                              'FILE_NAME');
        }
    };
    if (defined $filename) {
        $widget->insert(0, $filename);
    }
}


Ich brauche jedoch ein Drag&Drop, das auch von Webbrowsern aus funktioniert (egal ob IE oder FireFox). Hat wer Ahnung, wie das geht?
perl -le "s::*erlco'unaty.'.dk':e,y;*kn:ai;penmic;;print"
http://www.fabiani.net/

View full thread Tk Drag&Drop aus Webbrowser