--- capa/capa51/GUITools/gradesubjective.tcl 1999/09/28 21:25:37 1.1.1.1 +++ capa/capa51/GUITools/gradesubjective.tcl 1999/11/05 19:32:17 1.3 @@ -50,10 +50,10 @@ proc createGradeSubjWindow {} { pack $msglist $msgbutton -side top pack configure $msgbutton -anchor w - set gSubj(response) [listbox $msglist.list -width 40 -height 5 \ - -yscrollcommand "$msglist.scroll set"] + set gSubj(responseList) [listbox $msglist.list -width 40 -height 5 \ + -yscrollcommand "$msglist.scroll set"] scrollbar $msglist.scroll -command "$msglist.text yview" - pack $gSubj(response) $msglist.scroll -side left + pack $gSubj(responseList) $msglist.scroll -side left pack configure $msglist.scroll -fill y set gSubj(numresponse) 0 @@ -78,7 +78,10 @@ proc createGradeSubjWindow {} { pack configure $idlist.scroll -fill y button $idbutton.delete -text Delete -command subjDeleteId - pack $idbutton.delete + frame $idbutton.spacer -width 30 + label $idbutton.l1 -text "\# Words:" + label $idbutton.words -textvariable gSubj(numwords) + pack $idbutton.delete $idbutton.spacer $idbutton.l1 $idbutton.words -side left set response [frame $grade.response] pack $response @@ -318,6 +321,9 @@ proc subjNext {} { subjInsertIds $id } + append words [string trim [$gSubj(response) get 0.0 end-1c]] " " + set ws [format " \t\n"] + set gSubj(numwords) [regsub -all -- \[$ws\]+ $words {} b] wm title .gradesubjective "Grading Subjective, Set $gSubj(set), Prob $gSubj(quest), $id" if { [catch {set gSubj(score) $gSubj(done.$id.score)}] } { set gSubj(score) "" @@ -674,15 +680,20 @@ proc subjSendResponse {} { global gSubj } +########################################################### +# subjIndexResponse +########################################################### +########################################################### +########################################################### proc subjIndexResponse {} { global gSubj - $gSubj(response) delete 0 end + $gSubj(responseList) delete 0 end set i 0 foreach element [lsort -dictionary [array names gSubj "response.*"]] { - set head [string range $gSubj($element) 0 30] - $gSubj(response) insert end "[incr i]. $head" + regsub -all -- "\n\r\t" [string range $gSubj($element) 0 30] " " head + $gSubj(responseList) insert end "[incr i]. $head" } } @@ -696,6 +707,7 @@ proc subjSaveResponse {} { set num [incr gSubj(numresponse)] set gSubj(response.$num) [$gSubj(responseEdit) get 0.0 end] + destroy [winfo toplevel $gSubj(responseEdit)] subjIndexResponse } @@ -717,11 +729,13 @@ proc subjNewResponse {} { set textFrame [frame $response.text] set buttonFrame [frame $response.button] + pack $textFrame $buttonFrame set gSubj(responseEdit) [text $textFrame.text -yscrollcommand \ "$textFrame.scroll set" -wrap char -height 15] scrollbar $textFrame.scroll -command "$textFrame.text yview" - pack $textFrame.scroll $textFrame.text -side left -expand 1 + pack $textFrame.text $textFrame.scroll -side left -expand 1 + pack configure $textFrame.scroll -fill y button $buttonFrame.save -text Save -command "subjSaveResponse" button $buttonFrame.forget -text Cancel -command "destroy $response"