From 580650bb548b99c48b31b0343bbd82314afae367 Mon Sep 17 00:00:00 2001 From: Nick White Date: Mon, 23 Apr 2012 00:18:15 +0100 Subject: Make gui code clearer, and clipboard code more sensible --- getxbookgui.tcl | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/getxbookgui.tcl b/getxbookgui.tcl index 2596095..06b3286 100755 --- a/getxbookgui.tcl +++ b/getxbookgui.tcl @@ -42,16 +42,19 @@ proc go {} { proc parseurl {url} { global bins - for {set i 0} {$i < [llength $bins]} {incr i} { - set b [lindex $bins $i] + set newid "" + set i 0 + foreach b $bins { if { [string match [lindex $b 3] "$url"] } { selbin $i set binregex [lindex $b 4] if {"$binregex" != "" && [regexp "$binregex" $url m sub]} { - .input.id delete 0 end - .input.id insert 0 "$sub" + set newid "$sub" } + .input.id delete 0 end + .input.id insert 0 "$newid" } + incr i } } @@ -81,8 +84,8 @@ label .input.lab entry .input.id -width 14 frame .binfr -for {set i 0} {$i < [llength $bins]} {incr i} { - set b [lindex $bins $i] +set i 0 +foreach b $bins { set binname [lindex $b 0] if { [catch {image create photo im$i -file "$iconpath/$binname.gif"}] } { image create photo im$i @@ -92,6 +95,7 @@ for {set i 0} {$i < [llength $bins]} {incr i} { pack .binfr.$i -side left bind .binfr.$i {set manual 1} bind .binfr.$i