Thread Tk::Text, bei Eingabe 'insert' sichtbar? (6 answers)
Opened by #Kein Kommentar at 2007-12-10 14:42

Spieler
 2008-01-21 00:40
#104970 #104970
User since
2007-09-24
70 Artikel
BenutzerIn
[default_avatar]
Hallo,

geht es so:
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
29
30
31
32
33
34
35
36
use Tk;
use Tk::TextUndo;


package Tk::TextUndo;
sub InsertKeypress
{
my ($w,$char)=@_;
return if $char eq '';
if ($char =~ /^\S$/ and !$w->OverstrikeMode and !$w->tagRanges('sel'))
{
my $index = $w->index('insert');
my $undo_item = $w->getUndoAtIndex(-1);
if (defined($undo_item) &&
($undo_item->[0] eq 'delete') &&
($undo_item->[2] == $index)
)
{
$w->SUPER::insert($index,$char);
$undo_item->[2] = $w->index('insert');
$w->see('insert'); #######ergaenzt
return;
}
}
$w->addGlobStart;
$w->SUPER::InsertKeypress($char);
$w->addGlobEnd;
}
package main;


my $mw = tkinit;

my $testundo = $mw-> Scrolled ('TextUndo', -wrap => 'none',)-> pack ();

MainLoop;


Christoph

View full thread Tk::Text, bei Eingabe 'insert' sichtbar?