summaryrefslogtreecommitdiffstats
path: root/library/tkfbox.tcl
diff options
context:
space:
mode:
authorhobbs <hobbs@noemail.net>2001-03-30 06:02:20 (GMT)
committerhobbs <hobbs@noemail.net>2001-03-30 06:02:20 (GMT)
commit72a45ce8ee9924c180023e21bdff46ef6053d94a (patch)
treec02ec0c7b7fe416bdadfd664b741daa195658b86 /library/tkfbox.tcl
parent44835bae7f9821dd129f81678a0765633d43440a (diff)
downloadtk-72a45ce8ee9924c180023e21bdff46ef6053d94a.zip
tk-72a45ce8ee9924c180023e21bdff46ef6053d94a.tar.gz
tk-72a45ce8ee9924c180023e21bdff46ef6053d94a.tar.bz2
* library/tkfbox.tcl: fixed selecting directories and single files
with spaces using tk_getOpenFile -multiple 1. [Bug #411640] FossilOrigin-Name: 01457710ef0c3889652451e419667cb626c6b897
Diffstat (limited to 'library/tkfbox.tcl')
-rw-r--r--library/tkfbox.tcl24
1 files changed, 15 insertions, 9 deletions
diff --git a/library/tkfbox.tcl b/library/tkfbox.tcl
index b8b3322..245a11a 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.24 2000/10/19 01:05:01 ericm Exp $
+# RCS: @(#) $Id: tkfbox.tcl,v 1.25 2001/03/30 06:02:20 hobbs Exp $
#
# Copyright (c) 1994-1998 Sun Microsystems, Inc.
#
@@ -1003,9 +1003,9 @@ static char updir_bits[] = {
#
if { [string equal $class TkFDialog] } {
if { $data(-multiple) } {
- set fNameCaption "[::msgcat::mc {File names:}]"
+ set fNameCaption "[::msgcat::mc {File names:}]"
} else {
- set fNameCaption "[::msgcat::mc {File name:}]"
+ set fNameCaption "[::msgcat::mc {File name:}]"
}
set fTypeCaption [::msgcat::mc "Files of type:"]
set fCaptionWidth [::msgcat::mcmax $fNameCaption $fTypeCaption]
@@ -1147,9 +1147,9 @@ proc ::tk::dialog::file::SetSelectMode {w multi} {
set dataName __tk_filedialog
upvar ::tk::dialog::file::$dataName data
if { $multi } {
- set fNameCaption "[::msgcat::mc {File names:}]"
+ set fNameCaption "[::msgcat::mc {File names:}]"
} else {
- set fNameCaption "[::msgcat::mc {File name:}]"
+ set fNameCaption "[::msgcat::mc {File name:}]"
}
set fNameUnder 5
set iconListCommand [list ::tk::dialog::file::OkCmd $w]
@@ -1499,12 +1499,17 @@ proc ::tk::dialog::file::EntFocusOut {w} {
#
proc ::tk::dialog::file::ActivateEnt {w} {
upvar ::tk::dialog::file::[winfo name $w] data
-
+
set text [$data(ent) get]
if {$data(-multiple)} {
+ # For the multiple case we have to be careful to get the file
+ # names as a true list, watching out for a single file with a
+ # space in the name. Thus we query the IconList directly.
+
set data(selectFile) ""
- foreach fname $text {
- ::tk::dialog::file::VerifyFileName $w $fname
+ foreach item [tkIconList_Curselection $data(icons)] {
+ ::tk::dialog::file::VerifyFileName $w \
+ [tkIconList_Get $data(icons) $item]
}
} else {
::tk::dialog::file::VerifyFileName $w $text
@@ -1622,7 +1627,8 @@ proc ::tk::dialog::file::OkCmd {w} {
lappend text [tkIconList_Get $data(icons) $item]
}
- if {[llength $text] && !$data(-multiple)} {
+ 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 {[file isdirectory $file]} {