Hi All!
I am using Tk Canvas for bioinformatic software design
(multiple alignment visualization).
I have found one malfunction of long text items --
if text item is VERY long it scrolling "hangs" when
scroll displacement reaches ~32000 pixels (I am not sure
this value is correct).
I bypassed this bug with splitting text item into
small chunks (~200 letters).
Howerever, it's tricky way.
So, there is my test (tk version is tk-8.3.3-67):
############## cut here ##############################
#!/bin/sh
# the next line restarts using wish\
exec wish "$0" "$@"
set longstring [string repeat "bug!_" 10000]
canvas .c -width 700 -height 50 -xscrollcommand ".s set" \
-scrollregion "0 0 200000 50"
scrollbar .s -command ".c xview" -orient horiz
.c create text 3 10 -anchor w -text $longstring
pack .c -expand 1 -fill both -side top
pack .s -expand 1 -fill x -side bottom
############## cut here ##############################
Thanks in advance,
Dmitry Samborsky, Moscow
Logged In: YES
user_id=79902
The problem is that the width of something being drawn has
to fit in a signed short int, and it appears that the canvas
isn't pre-clipping the string right. (Which IIRC isn't that
easy to do, though it should be possible by passing smaller
chunks to the appropriate low-level text measurer.)
Which platform are you observing this problem on?
Logged In: NO
> The problem is that the width of something being drawn has
> to fit in a signed short int, and it appears that the canvas
> isn't pre-clipping the string right. (Which IIRC isn't that
> easy to do, though it should be possible by passing smaller
> chunks to the appropriate low-level text measurer.)
Why Tk uses short int type? Is it done for native work with Xlib
(avoiding X protocol overflow)?
Does it mean this Tk fault won't be fixed in future?
> Which platform are you observing this problem on?
I have observed this behavior at Linux RedHat7.3
(sorry I can't now query Tk version).
Thanks in advance,
Dmitry Samborsky, Moscow
Logged In: YES
user_id=79902
X defines coordinates and dimensions using short ints (which
is likely to be adequate for a while yet) and altering this
requres a major protocol revision (i.e. it would be a
massive job, and is way out of the responsibility of Tk.)
(Dimensions might actually be unsigned shorts; I can't
remember and can't be bothered to look it up.)
On the other hand, we do try to make Tk resistant to this
sort of problem where possible (the pre-clipping I
mentioned) even though it seems we're not yet there. (The
problem is that the font/string measuring engine is
restricted by the short int issue as well, despite the fact
that that is what is needed to restrict everything else.)
I'm not sure who is the best person to work on this;
development with Tk is currently awkward for me for local
config reasons...
Logged In: YES
user_id=32170
I know about text _widgets_ but nothing at all about the
canvas and its embedded types... sorry...
As a data point: I pasted the above into a Wish 8.5 console
on windows-xp, and am unable to see the text box at all...