How do you bind to a window size change?



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?
.



Relevant Pages

  • Re: Do you agree, its a nonsense [winfo ismapped $x]?
    ... what it was some time before, when you created/deiconified that widget. ... In none of the popup dialogs I'm using "ismapped" - there's no need. ... pack .t.f.b1 ... objects can include the state variables as part of ...
    (comp.lang.tcl)
  • Re: tk widget
    ... Now where I set NOS for textvariable and use this variable when I bind is not working corrrectly. ... So, when you change the value in that textvariable, it changes every widget associated with that variable. ... foreach FN $SCR3 {set FN1 "Field $FN" frame .editFr$FN -borderwidth 10 pack .editFr$FN -side top -fill x ... The main drawback to binding on doesn't handle other cases such as when the user uses the tab or shift-tab key to go to a different field, or clicks in another field, etc. ...
    (comp.lang.tcl)
  • Re: How to rearrange already packed widgets?
    ... pack have been used while creating this UI. ... So I tried called 'grid ... default, if widget a was created before widget b, then widget a is below ... widget b in the stacking order and will be "covered" by widget b. ...
    (comp.lang.tcl)
  • Re: OO in 8.5! Re: TIP #257: Object Orientation for Tcl
    ... Currently it's missing initializing options based on ... WidgetClass Foo -superclass Widget ... pack ... my forward invoke1 $widgetpath.b1 invoke ...
    (comp.lang.tcl)
  • Packing cannot be that difficult, can it?
    ... How to a canvas at the very bottom of ... I found out that if I increase the height of my text widget the ... pack $leftFr -side left ... set rightFr [frame $parent.rightFr] ...
    (comp.lang.tcl)