Tk Library Source Code

Artifact [2bc8d83e04]
Login

Artifact 2bc8d83e04d29ba249920a53cbecbdf62a2640d9:

Attachment "progress.patch" to ticket [498104ffff] added by chris_nelson 2001-12-31 23:10:48.
Index: progressbar.tcl
===================================================================
RCS file: /pti/prod/mrd/CvsRepository//tcl/bwidget/progressbar.tcl,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -w -r1.1.1.1 -r1.2
--- progressbar.tcl	2001/09/05 00:08:10	1.1.1.1
+++ progressbar.tcl	2001/11/06 17:36:57	1.2
@@ -11,6 +11,12 @@
 # ------------------------------------------------------------------------------
 
 namespace eval ProgressBar {
+    BWLabel::use
+
+    Widget::bwinclude ProgressBar BWLabel .l \
+        remove {-bd -borderwidth -fg -foreground -width -height} \
+        rename {-foreground -textfg -width -textwidth -height -textheight}
+
     Widget::declare ProgressBar {
         {-type        Enum       normal     0 {normal incremental infinite}}
         {-maximum     Int        100        0 "%d >= 0"}
@@ -21,6 +27,7 @@
         {-relief      TkResource sunken     0 label}
         {-orient      Enum       horizontal 1 {horizontal vertical}}
         {-variable    String     ""         0}
+        {-textvariable String     ""         0}
         {-idle        Boolean    0          0}
         {-width       TkResource 100        0 frame}
         {-height      TkResource 4m         0 frame}
@@ -29,10 +36,12 @@
         {-bd          Synonym    -borderwidth}
     }
 
-    Widget::addmap ProgressBar "" :cmd {-background {} -width {} -height {}}
+    Widget::addmap ProgressBar "" :cmd {-background {}}
     Widget::addmap ProgressBar "" .bar {
-	-troughcolor -background -borderwidth {} -relief {}
+	-troughcolor -background -borderwidth {} -relief {} -width {}
+        -height {}
     }
+    Widget::addmap ProgressBar "" .l {-textvariable {}}
 
     variable _widget
 
@@ -53,6 +62,8 @@
 	    -highlightthickness 0 -relief flat
     Widget::initFromODB ProgressBar $path $maps(ProgressBar)
 
+    set label [eval label $path.l $maps(.l)]
+
     set c  [eval canvas $path.bar $maps(.bar) -highlightthickness 0]
     set fg [Widget::cget $path -foreground]
     if { ![string compare [Widget::cget $path -orient] "horizontal"] } {
@@ -146,9 +157,13 @@
 
     if { ![GlobalVar::exists $_widget($path,var)] ||
          [set val [GlobalVar::getvar $_widget($path,var)]] < 0 } {
-        catch {place forget $path.bar}
+        catch {grid forget $path.l}
+        catch {grid forget $path.bar}
     } else {
-        place $path.bar -relx 0 -rely 0 -relwidth 1 -relheight 1
+        grid $path.l -sticky nw
+        grid $path.bar -sticky nw
+        grid columnconfigure $path 0 -weight 1
+
         set type [Widget::getoption $path -type]
         if { $val != 0 && [string compare $type "normal"] } {
             set val [expr {$val+$_widget($path,val)}]
Index: BWman/ProgressBar.html
===================================================================
RCS file: /pti/prod/mrd/CvsRepository//tcl/bwidget/BWman/ProgressBar.html,v
retrieving revision 1.1.1.1
diff -u -w -r1.1.1.1 ProgressBar.html
--- ProgressBar.html	2001/09/05 00:08:14	1.1.1.1
+++ ProgressBar.html	2001/12/31 15:54:59
@@ -22,6 +22,7 @@
 </TR>
 <TR>
 <TD>&nbsp;&nbsp;<A HREF="options.htm#M-relief">-relief</A></TR>
+<TD>&nbsp;&nbsp;<A HREF="options.htm#M-textvariable">-textvariable</A></TR>
 <TD>&nbsp;&nbsp;<A HREF="options.htm#M-troughcolor">-troughcolor</A></TR>
 </TR>
 </TABLE></DD>