|
|
I have a very large table that I want to display and it must be done
in pure tcl (no external packages). My approach is to make a text
widget that shows a viewport of a portion of the table. Then only the
cells that are being viewed will be shown within the text widget. In
actuality the entry widgets within the text widget would never change
but the data would change in the entry widgets as the scrollbars were
moved. I hope that's clear. Anyway, my problem is that I can do the
above okay but when the text widget size (height and/or width) is
changed I want the reevaluate the number of cells in the viewport and
add or remove any if needed. My first shot at that is the following:
proc chgSize {} {
set wdth [.txt cget -width]
set x [expr {$wdth/18}]
for {set i 0} {$i <= $x} {incr i} {
destroy .txt.ent$i
entry .txt.ent$i -width 15
.txt window create end -window .txt.ent$i
}
}
text .txt -wrap none -yscrollcommand ".vscroll set" -xscrollcommand
".hscroll set"
scrollbar .vscroll -command ".txt yview"
scrollbar .hscroll -command ".txt xview" -orient horizontal
pack .vscroll -side right -fill y
pack .hscroll -side bottom -fill x
pack .txt -fill both -expand yes
chgSize
bind .txt <Configure> "chgSize"
However, this method does not let me actually resize the text widget.
So I'm stumped -- can anybody help?
|
|