summaryrefslogtreecommitdiff
path: root/itcl/iwidgets3.0.0/generic/feedback.itk
diff options
context:
space:
mode:
Diffstat (limited to 'itcl/iwidgets3.0.0/generic/feedback.itk')
-rw-r--r--itcl/iwidgets3.0.0/generic/feedback.itk19
1 files changed, 12 insertions, 7 deletions
diff --git a/itcl/iwidgets3.0.0/generic/feedback.itk b/itcl/iwidgets3.0.0/generic/feedback.itk
index 54c1f7b4d26..3e765bec3f8 100644
--- a/itcl/iwidgets3.0.0/generic/feedback.itk
+++ b/itcl/iwidgets3.0.0/generic/feedback.itk
@@ -109,7 +109,7 @@ proc ::iwidgets::feedback {pathName args} {
# ------------------------------------------------------------------
# CONSTRUCTOR
# ------------------------------------------------------------------
-body iwidgets::Feedback::constructor {args} {
+itcl::body iwidgets::Feedback::constructor {args} {
itk_component add trough {
frame $itk_interior.trough -relief sunken
} {
@@ -138,13 +138,15 @@ body iwidgets::Feedback::constructor {args} {
grid rowconfigure $itk_interior 1 -weight 1
grid columnconfigure $itk_interior 0 -weight 1
+ bind $itk_component(hull) <Configure> [itcl::code $this _display]
+
eval itk_initialize $args
}
# ------------------------------------------------------------------
# DESTRUCTOR
# ------------------------------------------------------------------
-body iwidgets::Feedback::destructor {} {
+itcl::body iwidgets::Feedback::destructor {} {
}
# ------------------------------------------------------------------
@@ -156,7 +158,7 @@ body iwidgets::Feedback::destructor {} {
#
# Set the total number of steps.
# ------------------------------------------------------------------
-configbody iwidgets::Feedback::steps {
+itcl::configbody iwidgets::Feedback::steps {
step 0
}
@@ -170,9 +172,12 @@ configbody iwidgets::Feedback::steps {
# Displays the bar in the trough with the width set using the current number
# of steps.
# -----------------------------------------------------------------------------
-body iwidgets::Feedback::_display {} {
+itcl::body iwidgets::Feedback::_display {} {
+ update idletasks
set troughwidth [winfo width $itk_component(trough)]
- set _barwidth [expr $troughwidth.0/$itk_option(-steps)]
+ set _barwidth [expr \
+ (1.0*$troughwidth-(2.0*[$itk_component(trough) cget -borderwidth])) / \
+ $itk_option(-steps)]
set fraction [expr int((1.0*$_stepval)/$itk_option(-steps)*100.0)]
$itk_component(percentage) config -text "$fraction%"
@@ -186,7 +191,7 @@ body iwidgets::Feedback::_display {} {
#
# Resets the status bar to 0
# ------------------------------------------------------------------
-body iwidgets::Feedback::reset {} {
+itcl::body iwidgets::Feedback::reset {} {
set _stepval 0
_display
}
@@ -196,7 +201,7 @@ body iwidgets::Feedback::reset {} {
#
# Increase the value of the status bar by inc. Default to 1
# ------------------------------------------------------------------
-body iwidgets::Feedback::step {{inc 1}} {
+itcl::body iwidgets::Feedback::step {{inc 1}} {
if {$_stepval >= $itk_option(-steps)} {
return