2tall has asked for the wisdom of the Perl Monks concerning the following question:

I'm new to Perl/TK and I'm trying to build a text editor using the SuperText widget. I want to be able to get the current line number ( where the cursor is flashing ... ).

Is there any way I can do this, can anyone point me in the right direction?

Thx.

Replies are listed 'Best First'.
Re: SuperText Widget
by stefan k (Curate) on Mar 30, 2001 at 15:05 UTC
    Howdy,
    actually I have never used PerlTK but a quick GoogleSearch produced a documentation at

    http://www.lns.cornell.edu/~pvhp/ptk/doc/

    which contains a description of the TextWidget. I dunno if this is the same as for your SuperText widget, but maybe this is useful for you:

    $text->dlineinfo(index) Returns a list with five elements describing the area occupied by the display line containing index. The first two elements of the list give the x and y coordinates of the upper-left corner of the area occupied by the line, the third and fourth elements give the width and height of the area, and the fifth element gives the position of the baseline for the line, measured down from the top of the area. All of this information is measured in pixels. If the current wrap mode is none and the line extends beyond the boundaries of the window, the area returned reflects the entire area of the line, including the portions that are out of the window. If the line is shorter than the full width of the window then the area returned reflects just the portion of the line that is occupied by characters and embedded windows. If the display line containing index is not visible on the screen then the return value is an empty list.

    Well, I'm sorry if this is not what you are looking for..

    Regards Stefan K

      Thanks but I already saw that one. The problem is you have to pass it the line number on which you want information. But that is exactly what I want .. i.e The line number.
        OK,
        sorry 'bout that. Then I'm out here :(

        Regards Stefan K