Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
$text->see(index) Adjusts the view in the window so that the character given by index is completely visible. If index is already visible then the command does nothing. If index is a short distance out of view, the command adjusts the view just enough to make index visible at the edge of the window. If index is far out of view, then the command centers index in the window.To me this means if the "index" is slightly to the top of the visible screen it will move the "index" position to the top edge of the widget window. If the "index" is slightlly off the screen to the bottom of the widget window it will position the "index" at the bottom edge of the window.
However when I use this function it seems to want a value in the form of x.x (line.character). I give it this value and it runs fine but when this value gets to be 2.0 the scroll fucntion jumps to the very last line (in this case 950).
Why is this?
Here is the subroutine in question:
sub line_num { my $total_lines = shift; my $line_number = ($t->index('insert')); print $line_number,"\n"; $linenumbers->delete("1.0", "end"); for (0..$total_lines) { $linenumbers->insert('end', join "\n", map {sprintf "%4d", $_ } +$_); } #$linenumbers->yviewMoveto($line_number/$total_lines); #$linenumbers->yview(-pickplace, $line_number); $linenumbers->see($line_number); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Valid values of Tk::Text see() function.
by JamesNC (Chaplain) on Jul 30, 2004 at 03:08 UTC | |
by Anonymous Monk on Jul 30, 2004 at 12:50 UTC | |
by JamesNC (Chaplain) on Jul 30, 2004 at 16:27 UTC | |
by Anonymous Monk on Jul 30, 2004 at 16:49 UTC | |
by sandfly (Beadle) on Aug 01, 2004 at 21:45 UTC |