Re: scrollbar question
- From: "Gerald W. Lester" <Gerald.Lester@xxxxxxx>
- Date: Thu, 29 Mar 2007 11:23:31 -0500
You don't grid the frame into the text widget.
Read the man/help page for text widget, pay particular attention to the window subcommand.
BTW, you may also want to check out ScrolledWindow megawidget from the BWidgets package.
madman wrote:
I'm a self-proclaimed "intermediate" level tcl programmer and I'm
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"
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
--
+--------------------------------+---------------------------------------+
| Gerald W. Lester |
|"The man who fights for his ideals is the man who is alive." - Cervantes|
+------------------------------------------------------------------------+
.
- References:
- scrollbar question
- From: madman
- scrollbar question
- Prev by Date: Re: reusing "code entities" without oop
- Next by Date: Re: scrollbar question
- Previous by thread: scrollbar question
- Next by thread: Re: scrollbar question
- Index(es):
Relevant Pages
|