Re: scrollbar question



madman wrote:
I'm a self-proclaimed "intermediate" level tcl programmer and I'm
me too,
having problems displaying data in a scrolling window. Basically, I
want to display some data (rows and columns) in a window that can be
scrolled. My idea was to insert a grid frame inside a textbox with a
scrollbar attached. My problem is that although the scrollbar appears,
it doesn't "scroll". Can anybody help me?? Below is a sample code:

toplevel .manBox
wm geometry .manBox +300+5

scrollbar .manBox.scroll -command ".manBox.view yview"
text .manBox.view -yscrollcommand ".manBox.scroll set" -bg white
frame .manBox.view.grid

set c1_result 1.0
set c2_result 2.0
set c3_result 3.0

set c1 [label .manBox.view.grid.c1_0 -text "Port #"]
set c2 [label .manBox.view.grid.c2_0 -text "Diff #"]
set c3 [label .manBox.view.grid.c3_0 -text "Port E"]

grid $c1 -row 0 -column 1
grid $c2 -row 0 -column 2
grid $c3 -row 0 -column 3

for {set i 1} {$i <= 25} {incr i} {

set c1 [label .manBox.view.grid.c1_$i -textvariable c1_result]
set c2 [label .manBox.view.grid.c2_$i -textvariable c2_result]
set c3 [label .manBox.view.grid.c3_$i -textvariable c3_result]

grid $c1 -row $i -column 1
grid $c2 -row $i -column 2
grid $c3 -row $i -column 3
}

pack .manBox.scroll -side right -fill y
pack .manBox.view
grid .manBox.view.grid -in .manBox.view
.manBox.view configure -state disable

you have connected the text widget and the scroll bar.
and that works. ( comment out the last two lines of you
script to show this.)

Then you use grid to pack a lot of *** into the geometric
constraints of the text widget.
This is nothing the textwidget knows about and thus cannot scroll.



uwe

.


Quantcast