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

Spieler
 2007-11-15 15:28
#102438 #102438
User since
2007-09-24
70 Artikel
BenutzerIn
[default_avatar]
Hallo,

das ist jetzt wahrscheinlich keine befriedigende Antwort. So würde wenigstens ein paste (Ctrl-v) funktionieren (nicht auf unerwünschte Nebenwirkungen getestet):

Code: (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
use strict;
use warnings;
package Tk::MyLB;
require Tk::Listbox;
our @ISA = qw /Tk::Listbox Tk::Clipboard/;
Tk::Widget->Construct('MyLB');
sub ClassInit{
my ($class,$mw) = @_;
$class->SUPER::ClassInit($mw);
$mw->bind($class,'<Control-v>','insert_from_cb');
}
sub insert_from_cb{
my $self = shift;
$self->insert('end',$self->clipboardGet());
}
package main;
use Tk;
use strict;
use vars qw($top $drop);

$top = new MainWindow;
$top->Label(-text => "The drop area:")->pack;
$drop = $top->Scrolled('MyLB',
-scrollbars => "osoe",
-takefocus => 1,
)->pack;

MainLoop;


PS: kann man die Anzeige der Zeilennummern für [perl] ge'tag'ten code irgendwie unterbinden? Ich mache jetzt z.B.
Code: (dl )
perl -pi'*.ori' -e"s/^\d+://" test.pl
damit, aber ich finde das lästig.

Christoph

View full thread Tk Drag&Drop aus Webbrowser