Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | #!/bin/perl |
2 | ||
3 | use lib qw(/home1/gbartels/textlist); | |
4 | use Tk; | |
5 | ||
6 | use Tk::TextReindex qw(Tk::ROText ROTextReindex); | |
7 | ||
8 | $mw=new MainWindow; | |
9 | ||
10 | my $idx; | |
11 | ||
12 | $w=$mw->ROTextReindex()->pack(-side => "top"); | |
13 | $t=$mw->Label(-textvariable => \$idx)->pack(-side => "bottom"); | |
14 | ||
15 | $w->bind('<Key>',sub{$idx=$w->index("insert")}); | |
16 | ||
17 | $w->insert('end',"abcd\n"); | |
18 | $w->insert('end',"efgh\n"); | |
19 | $w->insert('end',"mnop\n"); | |
20 | $w->insert('end',"qrst\n"); | |
21 | $w->insert('end',"uvwx\n"); | |
22 | ||
23 | $w->insert('2.0',"ijkl\n"); | |
24 | ||
25 | my $string = $w->get('4.0'); | |
26 | ||
27 | ||
28 | my $result = "reading index 4.0 : expect string to equal >q<, actual value is $string \n"; | |
29 | $w->insert('end',$result); | |
30 | ||
31 | print $result; | |
32 | ||
33 | MainLoop; |