I try to make a simple statusbar, to show current cursor position in text widget.
Problem_1: it only works with the mousebutton. - I want to use the cursor buttons also in keyboard. So maybe it is not good to bind with mouse, it would be better to get the insertion cursor position. How?
Problem_2:I would like to use LineNumberText instead of Text, but current position doesn't work, it gives back '8'. I don't understand why.
Here is my little testscript:I appreciate any help!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 text\n"); $t->bind('<Button-1>' => [\&updateStatus]); MainLoop(); sub updateStatus { $status = $t->index('current'); print "$status\n"; }
In reply to cursor position in text widget and linenumbertext by balee
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |