From: sls Date: Thu, 23 Feb 1995 00:23:04 +0000 (+0000) Subject: Initial checkin from tkinspect 5.1.6 X-Git-Tag: r5_1_1~40 X-Git-Url: https://privyetmir.co.uk/gitweb.cgi?a=commitdiff_plain;h=45b0a327a456ed81b29089beeda7f6e770bf8b6a;p=tkinspect Initial checkin from tkinspect 5.1.6 --- diff --git a/stl-lite/feedback.tcl b/stl-lite/feedback.tcl new file mode 100644 index 0000000..7a488df --- /dev/null +++ b/stl-lite/feedback.tcl @@ -0,0 +1,53 @@ +# +# $Id$ +# + +dialog feedback { + param steps 10 + param title {} + param barwidth 200 + param barheight 20 + param barcolor DodgerBlue + member step 0 + member old_focus {} + method create {} { + $self config -bd 4 -relief ridge + label $self.title + pack $self.title -side top -fill x -padx 2 -pady 2 + frame $self.spacer + frame $self.bar -relief raised -bd 2 -highlightthickness 0 + pack $self.spacer $self.bar -side top -padx 10 -anchor w + label $self.percentage -text 0% + pack $self.percentage -side top -fill x -padx 2 -pady 2 + wm transient $self . + } + method reconfig {} { + $self.title config -text $slot(title) + $self.spacer config -width $slot(barwidth) + $self.bar config -height $slot(barheight) -bg $slot(barcolor) + center_window $self + update idletasks + } + method destroy {} { + if {[grab current $self] == $self} { + grab release $self + } + } + method grab {} { + while {[catch {grab set $self}]} { + } + } + method reset {} { + set slot(step) -1 + $self step + } + method step {{inc 1}} { + if {$slot(step) >= $slot(steps)} return + incr slot(step) $inc + set fraction [expr 1.0*$slot(step)/$slot(steps)] + $self.percentage config -text [format %.0f%% [expr 100.0*$fraction]] + $self.bar config -width [expr int($slot(barwidth)*$fraction)] + update + } +} +