Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^3: Valid values of Tk::Text see() function.

by JamesNC (Chaplain)
on Jul 30, 2004 at 16:27 UTC ( [id://378743]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Valid values of Tk::Text see() function.
in thread Valid values of Tk::Text see() function.

I don't know what widget $t is? It is definitely not the same widget he is using see() with and he is using the insertion point index of that widget. So, just working the problem backwards to that line should convince him that the problem is not in the see() function, but in the arguements he gave to it. Plug in '2.0' and it still works fine.
  • Comment on Re^3: Valid values of Tk::Text see() function.

Replies are listed 'Best First'.
Re^4: Valid values of Tk::Text see() function.
by Anonymous Monk on Jul 30, 2004 at 16:49 UTC
    What I have is a TextUndo widget and a ROText widget side by side. The TextUndo widget is the main window and the ROText is simply a 4 pixle width column that does line numbering.

    I have the two mapped and they scroll congruently using yscrollcommand so that is fine. I also created a function to have the scroll congruently when using a binded mousewheel scroll I had already implemented. The last thing that I am having issues with is if you use the arrow keys to scroll up or down. When I start on line "0" and hit the down arrow key to line one everything is fine but as soon as I hit it again and the line number value becomes 2 the ROText widget jumps all the way down to the last line of that widget but the TextUndo widget remains where it is at.

    As you cans ee from my source code I have tried a few methods using yview and implenting the "-pickplace" option but this option is suppose to be obsolete and replaced by the see() function. The closest I have gotten to the performance I want is using yviewMoveto(). However when I do this I start on line 0 and hit the arrow button down one and the line number column then shows the number 2 as the first number in the list and the TextUndo widget does not scroll so now the line number no longer matches up to it's line.

    I have also gotten them to stay together by having them both scroll when I hit the down key but this is not what I want either because neither window should scroll untill the value of "index" is off the screen (not visible). In the last example this is not the case. If I were to start on line 0 and hit the down arrow key both widgets would scroll and would now show line 1 at the top of the widget and move line 0 off the screen even though line 1 was already visible the widgets would still scroll to adjust.

    I hope that clears some things up. I know this is somewhat confusing especially when you are not really sure what I am doing in the first place.

      So, you want to ensure that the $linenumbers widget is positioned with the same vertical scroll as the $t widget. Perhaps you should ask $t where to scroll to:
      (my $ytop, undef) = $t->yview; $linenumbers->yviewMoveto( $ytop );
      (not tested)

      Incidentally, how have you managed to display a number such as 950 in a 4-pixel wide widget?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://378743]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (1)
As of 2024-04-24 16:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found