summaryrefslogtreecommitdiffstats
path: root/library/choosedir.tcl
diff options
context:
space:
mode:
authorericm <ericm>2000-06-23 00:22:27 (GMT)
committerericm <ericm>2000-06-23 00:22:27 (GMT)
commit2d36140194d24b7083dad675be4377b8f946974d (patch)
treea3d3693fe56641361ebf15e9bb9b2cf064f12034 /library/choosedir.tcl
parent85d8c4014f68a832ea11c9a60229f515dd01322e (diff)
downloadtk-2d36140194d24b7083dad675be4377b8f946974d.zip
tk-2d36140194d24b7083dad675be4377b8f946974d.tar.gz
tk-2d36140194d24b7083dad675be4377b8f946974d.tar.bz2
* doc/getOpenFile.n: Updated with information about -multiple.
* library/choosedir.tcl: Tweaked to handle modified tkIconList API's. * library/tkfbox.tcl: Preliminary implementation of multiple selection; based on patch from [RFE: 604]. Some of the tkIconList functions changed to support this and to make the dialog faster. * library/xmfbox.tcl: Added support for multiple selection, from patch in [RFE: 4999].
Diffstat (limited to 'library/choosedir.tcl')
-rw-r--r--library/choosedir.tcl17
1 files changed, 12 insertions, 5 deletions
diff --git a/library/choosedir.tcl b/library/choosedir.tcl
index acd6683..bae35af 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.7 2000/04/19 23:12:56 hobbs Exp $
+# RCS: @(#) $Id: choosedir.tcl,v 1.8 2000/06/23 00:22:28 ericm Exp $
# Make sure the tk::dialog namespace, in which all dialogs should live, exists
namespace eval ::tk::dialog {}
@@ -138,6 +138,11 @@ proc ::tk::dialog::file::chooseDir::Config {dataName argList} {
set data(-title) "Choose Directory"
}
+ # Stub out the -multiple value for the dialog; it doesn't make sense for
+ # choose directory dialogs, but we have to have something there because we
+ # share so much code with the file dialogs.
+ set data(-multiple) 0
+
# 4: set the default directory and selection according to the -initial
# settings
#
@@ -177,8 +182,9 @@ proc ::tk::dialog::file::chooseDir::OkCmd {w} {
# 4b. If the value is different from the current directory, change to
# that directory.
- set iconText [tkIconList_Get $data(icons)]
- if { ![string equal $iconText ""] } {
+ set selection [tkIconList_Curselection $data(icons)]
+ if { [llength $selection] != 0 } {
+ set iconText [tkIconList_Get $data(icons) [lindex $selection 0]]
set iconText [file join $data(selectPath) $iconText]
::tk::dialog::file::chooseDir::Done $w $iconText
} else {
@@ -214,8 +220,9 @@ proc ::tk::dialog::file::chooseDir::OkCmd {w} {
proc ::tk::dialog::file::chooseDir::DblClick {w} {
upvar ::tk::dialog::file::[winfo name $w] data
- set text [tkIconList_Get $data(icons)]
- if {[string compare $text ""]} {
+ set selection [tkIconList_Curselection $data(icons)]
+ if { [llength $selection] != 0 } {
+ set text [tkIconList_Get $data(icons) [lindex $selection 0]]
set file $data(selectPath)
if {[file isdirectory $file]} {
::tk::dialog::file::ListInvoke $w $text