--- capa/capa51/GUITools/gradesubjective.tcl 1999/12/07 19:10:47 1.7 +++ capa/capa51/GUITools/gradesubjective.tcl 1999/12/07 19:45:45 1.8 @@ -124,6 +124,8 @@ proc createGradeSubjWindow {} { set gSubj(keyword) [text $right.keyword -width 60 -height 5 \ -yscrollcommand "$right.scroll set" ] + puts $gSubj(keyword) + puts $right scrollbar $right.scroll -command "$right.response yview" pack $gSubj(keyword) $right.scroll -side left pack configure $right.scroll -fill y @@ -933,11 +935,59 @@ proc subjViewResponse {} { } ########################################################### +# subjUpdateResponse +########################################################### +########################################################### +########################################################### +proc subjUpdateResponse {} { + gSubj +} + +########################################################### +# subjUpdateKeywords +########################################################### +########################################################### +########################################################### +proc subjUpdateKeywords {} { + global gSubj + $gSubj(keyword) delete 0.0 end + puts $gSubj(keywords) + foreach keyword $gSubj(keywords) { lappend lokeyword [lindex $keyword 0] } + set lokeyword [lsort $lokeyword] + set max 0 + foreach key $lokeyword { + if { [string length $key] > $max } { set max [string length $key] } + } + incr max + set numcol [expr 60/$max] + set end [llength $lokeyword] + set lastline 0 + for { set i 0 } { $i < $end } { incr i } { + set line [expr $i/$numcol] + set col [expr $i%$numcol*$max] + puts $line.$col + $gSubj(keyword) insert end [format "%-[set max]s" [lindex $lokeyword $i]] + if {($col + (2*$max)) > 60} { + puts "Putting in newlne" + $gSubj(keyword) insert end "\n" + set lastline $line + } + } + subjUpdateResponse +} + +########################################################### # subjAddKeyword ########################################################### ########################################################### ########################################################### proc subjAddKeyword {} { global gSubj gUniqueNumber - + + if { "" == [set keyword [getString [winfo toplevel $gSubj(keyword)] "Enter a new keyword"]]} { + return + } + puts "New keyword $keyword" + lappend gSubj(keywords) [list $keyword [list $keyword]] + subjUpdateKeywords }