Tk Library Source Code

Artifact [0e328b7214]
Login

Artifact 0e328b7214f25ff58468e83590e40869f709c1a6:

Attachment "statusbar.tcl.patch" to ticket [1512671fff] added by mbroeken 2006-06-26 19:37:17.
Index: statusbar.tcl
===================================================================
RCS file: /cvsroot/tcllib/bwidget/statusbar.tcl,v
retrieving revision 1.8
diff -r1.8 statusbar.tcl
290c290
<     variable _widget
---
> 	variable _widget
292,313c292
<     set destroy [string equal [lindex $args 0] "-destroy"]
<     if {$destroy} {
< 	set args [lrange $args 1 end]
<     }
<     foreach w $args {
< 	set idx [lsearch -exact $_widget($path,items) $w]
< 	if {$idx == -1 || ![winfo exists $w]} {
< 	    # ignore unknown or non-widget items (like our separators)
< 	    continue
< 	}
< 	# separator is always previous item
< 	set sidx [expr {$idx - 1}]
< 	set sep  [lindex $_widget($path,items) $sidx]
< 	if {[string match .* $sep]} {
< 	    # not one of our separators
< 	    incr sidx
< 	} else {
< 	    # destroy separator too
< 	    set sep $path.sbar.$sep
< 	    grid forget $sep
< 	    destroy $sep
< 	}
---
> 	set destroy [string equal [lindex $args 0] "-destroy"]
315,317c294,331
< 	    destroy $w
< 	} else {
< 	    grid forget $w
---
> 		set args [lrange $args 1 end]
> 	}
> 	foreach w $args {
> 		set idx [lsearch -exact $_widget($path,items) $w]
> 		if {$idx == -1 || ![winfo exists $w]} {
> 			# ignore unknown or non-widget items (like our separators)
> 			continue
> 		}
> 		# separator is always previous item
> 		set sidx [expr {$idx - 1}]
> 		set sep [lindex $_widget($path,items) $sidx]
> 		if {[string match .* $sep]} {
> 			# not one of our separators
> 			incr sidx
> 		} else {
> 			# destroy separator too
> 			if {$sep ne ""} {
> 				set sep $path.sbar.$sep
> 				grid forget $sep
> 				destroy $sep
> 			}
> 		}
> 		if {$destroy} {
> 			destroy $w
> 		} else {
> 			grid forget $w
> 		}
> 		set _widget($path,items) [lreplace $_widget($path,items) $sidx $idx]
> 		if {$idx == 0} {
> 			# seperator of next item is no longer necessary
> 			set sep [lindex $_widget($path,items) $idx]
> 			if {$sep ne ""} {
> 				set sep $path.sbar.$sep
> 				grid forget $sep
> 				destroy $sep
> 				set _widget($path,items) [lreplace $_widget($path,items) $idx $idx]
> 			}
> 		}
319,320d332
< 	set _widget($path,items) [lreplace $_widget($path,items) $sidx $idx]
<     }