For Programmers: Free Programming Magazines  


Home > Archive > Tcl > July 2007 > Problem with text widget and "inherited" scrolling









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Problem with text widget and "inherited" scrolling
Tim Edwards

2007-07-24, 7:13 pm

I'm having trouble with a large text widget containing more than 2500
lines of text not refreshing properly. If the text widget is a top-
level entity tied to the scrollbar, there's no problem. If, however,
I put the text widget inside a scrollable frame and resize it to
reveal all of its content, things fall apart.

As a child of some other scrollable entity, the text widget only
displays the first 2500 or so lines, after which the widget is blank.
If I interact with the blank area, I get partial updates, but not all
binding respond. (In my actual application, the scrollable frame
contains several text widgets and other items... Everything works
fine unless a text widget exceeds the magic size.)

I have tried several versions of Tcl/Tk (both 8.4.x and 8.5.x), and
this behavior is consistent across them (at least on my platform, a
RHEL4 Intel-based box). I've also tried it with both BWidget's
scrolled frame as well as inside a scrollable canvas, with the "big"
text widget as an embedded window. Same problem in both!

Here's the example BWidget code:

########################################
###############
package require BWidget

toplevel .top
scrollbar .top.vsb -command ".top.sf yview"
set sfw [ ScrollableFrame .top.sf -yscrollcommand ".top.vsb set" ]

pack .top.sf -side left -fill both -expand 1
pack .top.vsb -side left -fill y

set sf [$sfw getframe]
pack [frame $sf.block0 -bg red] -side top -fill x
pack [set t [text $sf.block0.text -undo 1]] -fill x

for {set i 0} {$i < 3000} {incr i} {
$t insert end "$i\n"
}

$t config -height 3000
########################################
###############

Any ideas out there?

Thanks!

Bruce Hartweg

2007-07-24, 7:13 pm


Tim Edwards wrote:
> I'm having trouble with a large text widget containing more than 2500
> lines of text not refreshing properly. If the text widget is a top-
> level entity tied to the scrollbar, there's no problem. If, however,
> I put the text widget inside a scrollable frame and resize it to
> reveal all of its content, things fall apart.
>
> As a child of some other scrollable entity, the text widget only
> displays the first 2500 or so lines, after which the widget is blank.
> If I interact with the blank area, I get partial updates, but not all
> binding respond. (In my actual application, the scrollable frame
> contains several text widgets and other items... Everything works
> fine unless a text widget exceeds the magic size.)
>


You're hitting limits of the size of a window under X
(at the lowest level the size of a window is a Dimension
which is a #define for a short - so the maximum pixel
size of a window is 32K.) When the text handles the scrolling,
the window size is a normal value, and it handles the virtual
sizes directly and decides which line to render. when you put
it inside another container to handle the scrolling, the text
widget is asking for it's entire size to be realized (even though
most of it will be cropped by parent before display). the upshot
is that if you try to make a window that big you get into murky
waters, and the final effect will usually be visual bugs, but the
type and severity will depend upon the specific X-Server and window manager.

Bruce
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com