global tblN set tblN 0 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # # When we encounter a TABLE tag, we create a frame widget to contain the # # table, and bump up the in(TABLE) level indicator and the tblN counter. We # # then return, and hope that the following data is a table-related tag. # # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # proc tagTABLE {w T att} { global B D R me in opt tblN Twin Trow Tcol Txt txtlvl set id "$me/tagTABLE" if {$D>4} {puts "$id: w=\"$w\" Tag=\"$T\" att=\"$att\""} set t [incr tblN] incr in(TABLE) if {!$opt(TABLE)} { if {$D>4} {puts "$id: Table $tblN Suppressed."} ListEnter $w $T $att return } BR $w set b $B if {$D>1} {puts "$id: Table $t level $in(TABLE) is ..."} incr txtlvl set Txt($txtlvl) {.t.txt} if {$D>4} {puts "$id: Current Txt($txtlvl) is $Txt($txtlvl)"} if [winfo exists $w.tbl$t] {destroy $w.tbl$t} frame $w.tbl$t -bd $B -relief $R if {$D>4} {puts "$id: Frame $w.tbl$t created for table $t."} $w window create insert -window $w.tbl$t if {$D>4} {puts "$id: Frame $w.tbl$t inserted."} # label $w.tbl$t.caption -text "Table $t is $w.tbl$t" -bd $B -relief $R # if {$D>4} {puts "$id: Caption $w.tbl$t.caption created."} # pack $w.tbl$t.caption -in $w.tbl$t -side top -expand 1 -fill x # if {$D>4} {puts "$id: Caption $w.tbl$t.caption packed."} set Twin($t) $w.tbl$t set Tcol($t) 0 set Trow($t) 0 } # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # proc endTABLE {w T att} { global B D R me in opt tblN Twin Trow Tcol Txt txtlvl set id "$me/endTABLE" if {$D>4} {puts "$id: w=\"$w\" Tag=\"$T\" att=\"$att\""} incr in(TABLE) -1 if {!$opt(TABLE)} { if {$D>4} {puts "$id: Table $tblN Suppressed."} ListExit $w $T return } BR $w } # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # # Handle a
(table datum) tag. # proc tagTD {w att} { global B D W me in tblN Twin Trow Tcol Txt txtlvl set t $tblN ;# Current table ndx. set r $Trow($t) ;# Current table row. set c $Tcol($t) ;# Current table col. set tt [expr $t-1] if [info exists Txt($tt)] { set w $Txt($tt) if {$D>4} {puts "$me/HTML: w=\"$w\" taken from Txt($tt)"} } if {$D>4} {puts "$me/tagTD: w=$w att=\"$att\" tblN=$t Trow=$r Tcol=$c"} if {$D>4} {puts "$me/tagTD: Create text widget for tbl $t row $r col $c"} set cell $w.tbl${t}.r${r}c${c} if [winfo exists $cell] {destroy $cell} frame $cell ;# -height 4 -width 12 text $cell.t ;# -height 4 -width 12 if {$D>4} {puts "$me/tagTD: Created cell $cell text $cell.t"} $cell.t insert end "R${r}C${c} " grid $cell -row $r -column $c -sticky news -in $w.tbl${t} grid columnconfigure $w.tbl${t} $c -weight 1 grid propagate $w.tbl${t} if {$D>4} {puts "$me/tagTD: Gridded $cell -row $r -column $c -sticky news"} set Txt($txtlvl) [set W $cell.t] if {$D>4} {puts "$me/tagTD: Current W=Txt($txtlvl) is $cell"} pack $cell.t -in $cell -expand 1 -fill both } # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # proc tagTR {w att} { global B D me in tblN Twin Trow Tcol if {$D>4} {puts "$me/tagTR: w=$w att=\"$att\" tblN=$tblN Trow=$Trow($tblN) Tcol=$Tcol($tblN)"} }