Hallo,
das ist jetzt wahrscheinlich keine befriedigende Antwort. So würde wenigstens ein paste (Ctrl-v) funktionieren (nicht auf unerwünschte Nebenwirkungen getestet):
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.
perl -pi'*.ori' -e"s/^\d+://" test.pl
damit, aber ich finde das lästig.
Christoph