Thanks for your help!
Now I can see what was the problem with Linenumbertext.
My first problem was that statusupdate happened only in case of clicking in the text with the mousebutton. I also wanted to update status every keystroke... Meanwhile - with a little help - I figured out: $mw->bind('<KeyPress>' => [\&updateStatus]); In case of linenumbertext, it works, but with simple Text, - I don't understand why - it doesn't.use Tk; use Tk::LineNumberText; $mw = MainWindow->new; $t = $mw->Text()->pack(); #$t = $mw->LineNumberText('Text')->pack(); $t->insert('end', "This is some\n"); $t->insert('end', "normal texaaaat\n"); $t->insert('end', "normal textasdfasdf\n"); $t->insert('end', "normal textasdasd\n"); $t->bind('<Button-1>' => [\&updateStatus]); $t->bind('<KeyPress>' => [\&updateStatus]); MainLoop(); sub updateStatus { #my ($line,$col) = split(/\./,$t->{'rtext'}->index('insert')); #$status = "line: $line, col: $col"; $status = $t->index('current'); print "$status\n"; }
In reply to Re^2: cursor position in text widget and linenumbertext
by balee
in thread cursor position in text widget and linenumbertext
by balee
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |