--- capa/capa51/GUITools/common.tcl 2000/01/05 21:11:15 1.5 +++ capa/capa51/GUITools/common.tcl 2000/01/31 18:34:13 1.7 @@ -1432,9 +1432,13 @@ proc pickSections { sectionsToPickFrom { ########################################################### ########################################################### ########################################################### -proc pickSections { setsToPickFrom mode {title "Select Sets"} {window ""}} { +proc pickSets { setsToPickFrom mode {title "Select Sets"} {window ""}} { global gPromptPSets + if { $setsToPickFrom == "" } { + displayMessage "No available sets." + return "Cancel" + } set dialog [toplevel $window.pickSets -borderwidth 10] wm title $dialog "Which Sets" @@ -1464,7 +1468,7 @@ proc pickSections { setsToPickFrom mode pack configure $listboxFrame.scroll -fill y foreach set $setsToPickFrom { - $setList insert end [format "%3d" $set + $setList insert end [format "%3d" $set] } button $buttonFrame.yes -text Continue -command {set gPromptPSets(yes) 1} \ @@ -1475,9 +1479,14 @@ proc pickSections { setsToPickFrom mode button $buttonFrame.cancel -text Cancel -command { set gPromptPSets(yes) 0 } \ -underline 0 bind $dialog "set gPromptPSets(yes) 0" + bind $dialog "set gPromptPSets(yes) 1" - pack $buttonFrame.yes $buttonFrame.spacer \ - $buttonFrame.selectall $buttonFrame.cancel -side left + if { $mode == "single" } { + pack $buttonFrame.yes $buttonFrame.cancel -side left + } else { + pack $buttonFrame.yes $buttonFrame.spacer \ + $buttonFrame.selectall $buttonFrame.cancel -side left + } bind $dialog break @@ -1494,7 +1503,7 @@ proc pickSections { setsToPickFrom mode set selectionList [ $setList curselection ] set setsToDo "" foreach selection $selectionList { - append setsToDo "[lindex [$setList get $selection] 0] " + lappend setsToDo [string trim [lindex [$setList get $selection] 0]] } destroy $dialog return $setsToDo @@ -1631,6 +1640,15 @@ proc lunique __LIST { } } +########################################################### +# lreverse +########################################################### +proc lreverse list { + set result "" + foreach element $list { set result [linsert $result 0 $element] } + return [concat $result] +} + proc splitline { line maxLength } { set length [string length $line] set lines [expr $length/$maxLength + 1]