From d389b7c614bed2adeef2c44844cb67d6bc563b21 Mon Sep 17 00:00:00 2001 From: dkf Date: Mon, 17 Sep 2001 14:12:18 +0000 Subject: Fixed string/list confusion in directory browser, and a typo in ChangeLog --- ChangeLog | 9 ++++++++- library/choosedir.tcl | 7 ++++--- library/tkfbox.tcl | 25 +++++++++++++------------ 3 files changed, 25 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index 15353a1..529cb5a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2001-09-17 Donal K. Fellows + + * library/choosedir.tcl (DblClick): + * library/tkfbox.tcl (OkCmd, ListInvoke): Rewrote so as to avoid + the highly confusing string "text" and to be consistent about what + is and what is not a list. [Bug 459895, reported by fandom] + 2001-09-14 Andreas Kupries * generic/tkImgGIF.c: @@ -15,7 +22,7 @@ 2001-09-12 D. Richard Hipp - * Fix a bug in library/tkxbox.tcl + * Fix a bug in library/tkfbox.tcl 2001-09-10 Mo DeJong diff --git a/library/choosedir.tcl b/library/choosedir.tcl index ee4dfb1..8f1df99 100644 --- a/library/choosedir.tcl +++ b/library/choosedir.tcl @@ -5,7 +5,7 @@ # Copyright (c) 1998-2000 by Scriptics Corporation. # All rights reserved. # -# RCS: @(#) $Id: choosedir.tcl,v 1.10 2001/08/01 16:21:11 dgp Exp $ +# RCS: @(#) $Id: choosedir.tcl,v 1.11 2001/09/17 14:12:18 dkf Exp $ # Make sure the tk::dialog namespace, in which all dialogs should live, exists namespace eval ::tk::dialog {} @@ -222,10 +222,11 @@ proc ::tk::dialog::file::chooseDir::DblClick {w} { upvar ::tk::dialog::file::[winfo name $w] data set selection [tk::IconList_Curselection $data(icons)] if { [llength $selection] != 0 } { - set text [tk::IconList_Get $data(icons) [lindex $selection 0]] + set filenameFragment \ + [tk::IconList_Get $data(icons) [lindex $selection 0]] set file $data(selectPath) if {[file isdirectory $file]} { - ::tk::dialog::file::ListInvoke $w $text + ::tk::dialog::file::ListInvoke $w [list $filenameFragment] return } } diff --git a/library/tkfbox.tcl b/library/tkfbox.tcl index be10d49..7fce44e 100644 --- a/library/tkfbox.tcl +++ b/library/tkfbox.tcl @@ -11,7 +11,7 @@ # files by clicking on the file icons or by entering a filename # in the "Filename:" entry. # -# RCS: @(#) $Id: tkfbox.tcl,v 1.30 2001/09/12 19:13:56 drh Exp $ +# RCS: @(#) $Id: tkfbox.tcl,v 1.31 2001/09/17 14:12:18 dkf Exp $ # # Copyright (c) 1994-1998 Sun Microsystems, Inc. # @@ -1626,17 +1626,17 @@ proc ::tk::dialog::file::JoinFile {path file} { proc ::tk::dialog::file::OkCmd {w} { upvar ::tk::dialog::file::[winfo name $w] data - set text {} + set filenames {} foreach item [::tk::IconList_Curselection $data(icons)] { - lappend text [::tk::IconList_Get $data(icons) $item] + lappend filenames [::tk::IconList_Get $data(icons) $item] } - if {([llength $text] && !$data(-multiple)) || \ - ($data(-multiple) && ([llength $text] == 1))} { - set text [lindex $text 0] - set file [::tk::dialog::file::JoinFile $data(selectPath) $text] + if {([llength $filenames] && !$data(-multiple)) || \ + ($data(-multiple) && ([llength $filenames] == 1))} { + set filename [lindex $filenames 0] + set file [::tk::dialog::file::JoinFile $data(selectPath) $filename] if {[file isdirectory $file]} { - ::tk::dialog::file::ListInvoke $w [list $text] + ::tk::dialog::file::ListInvoke $w [list $filename] return } } @@ -1702,14 +1702,15 @@ proc ::tk::dialog::file::ListBrowse {w} { # Gets called when user invokes the IconList widget (double-click, # Return key, etc) # -proc ::tk::dialog::file::ListInvoke {w text} { +proc ::tk::dialog::file::ListInvoke {w filenames} { upvar ::tk::dialog::file::[winfo name $w] data - if {[llength $text] == 0} { + if {[llength $filenames] == 0} { return } - set file [::tk::dialog::file::JoinFile $data(selectPath) [lindex $text 0]] + set file [::tk::dialog::file::JoinFile $data(selectPath) \ + [lindex $filenames 0]] set class [winfo class $w] if {[string equal $class TkChooseDir] || [file isdirectory $file]} { @@ -1724,7 +1725,7 @@ proc ::tk::dialog::file::ListInvoke {w text} { } } else { if {$data(-multiple)} { - set data(selectFile) $text + set data(selectFile) $filenames } else { set data(selectFile) $file } -- cgit v0.12