If you add this line to the "load_url" sub, the widget behavior will be more "normal":
The point is that the scrollbar slider's size is based on line count and the number of lines visible in the scrolled widget at a given moment, as well as the total percentage of text visible (or something to that effect).$text =~ s/>/>\n/g; # add this right after "my $text = $tree->as_ +HTML()"
If the number of text lines (i.e. the number of substrings conjoined by explicit line-feed characters) is less than the height of the Tk::Text window, but the lines are really long and get wrapped beyond the height of the window, you have a situation where the slider-sizing logic (and possibly other aspects of scrollbar behavior) will likely run into boundary conditions, or situations where "reasonable defaults" are at best much more difficult to establish and implement.
I think the exact behavior of OP code may depend on whether the html data contains any line-feeds as text content, but I'm not sure about that, just as I'm not sure yet what HTML::TreeBuilder's "as_HTML()" method does to web-page data in terms of preserving or removing line-feed characters. (Maybe that'll be explained in the docs; I just haven't looked yet.)
So, if you simply take one or two simple measures to provide a sensible concession to human readability, things will go better, because the widgets seem to have been designed with some built-in assumptions about that sort of thing.
In reply to Re: Very strange Scrollbar behavior in Win32 Perl/Tk version 804.027
by graff
in thread Very strange Scrollbar behavior in Win32 Perl/Tk version 804.027
by liverpole
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |