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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.