global input Select V me in set Select(0) {} set in(SELECT) 0 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # # Handle a tag. # proc endSELECT w { global in LC incr in(SELECT) -1 HSP $w {} set LC {} } # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # # Return the selected item(s) from a listbox. It's possible that nothing is # selected, in which case we return a null string. For multiple selections, # we return them all with newlines in between. # proc GetSel {lb} { global V me if [catch {$lb curselection} x] { if {$V>2} {puts "$me/GetSel: $lb has nothing selected."} return {} } if {$V>2} {puts "$me/GetSel: $lb has {$x} selected."} set v {} set sep {} foreach s $x { if {$V>2} {puts "$me/GetSel: Get $s."} set v "$v$sep[$lb get $s]" if {$V>2} {puts "$me/GetSel: Got v=\"$v\""} set sep , } if {$V>2} {puts "$me/GetSel: Return \"$v\""} return $v } # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # # Process an terminator to tell us the end of the text. We use the # kludge of assuming that the option is on the same line, and using whatever # text follows, up to a '<' or newline, whichever comes first. This is one of # the reasons that the current text line is kept in the global Src variable. # proc tagOPTION {w t att} { global B C V R me Input input Select Src in if {$V>2} {puts "$me/tagOPTION: w={$w} t={$t} a={$att}"} if {$V>2} {puts "$me/tagOPTION: Src=\"$Src\""} set fr $Select([set i $input]) if [regexp {^(.*)(<.*)} $Src {} opt Src] { set v [string trim $opt] } else { set v [string trim $Src] set Src {} } if {[set w [string length $v]] > $Input(M$i)} { $fr.lb config -width [set Input(M$i) $w] } if {$V>2} {puts "$me/tagOPTION: v={$v} w=$w Input(M$i)=$Input(M$i)"} if {$V>4} {puts "$id: $fr.lb insert end \"$v\""} $fr.lb insert end $v }