summaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
authordonal.k.fellows@manchester.ac.uk <dkf>2004-07-11 22:21:19 (GMT)
committerdonal.k.fellows@manchester.ac.uk <dkf>2004-07-11 22:21:19 (GMT)
commit54d3d3da8a80c6ba82652ea2cae564f68c6bc8e8 (patch)
tree20fcf47027f050803fcf4dcca44058f731ee8cc1 /library
parentad65ac7bac0e9056575722ef1b1552cb68ff9eb6 (diff)
downloadtk-54d3d3da8a80c6ba82652ea2cae564f68c6bc8e8.zip
tk-54d3d3da8a80c6ba82652ea2cae564f68c6bc8e8.tar.gz
tk-54d3d3da8a80c6ba82652ea2cae564f68c6bc8e8.tar.bz2
Users can cause Unix file dialog to vanish early; treat like Cancel [Bug 987169]
Diffstat (limited to 'library')
-rw-r--r--library/tkfbox.tcl22
1 files changed, 19 insertions, 3 deletions
diff --git a/library/tkfbox.tcl b/library/tkfbox.tcl
index 2173a0d..45892ef 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.41 2003/11/12 00:07:03 hobbs Exp $
+# RCS: @(#) $Id: tkfbox.tcl,v 1.42 2004/07/11 22:21:19 dkf Exp $
#
# Copyright (c) 1994-1998 Sun Microsystems, Inc.
#
@@ -1079,9 +1079,14 @@ static char updir_bits[] = {
}
# the okBtn is created after the typeMenu so that the keyboard traversal
- # is in the right order
+ # is in the right order, and add binding so that we find out when the
+ # dialog is destroyed by the user (added here instead of to the overall
+ # window so no confusion about how much <Destroy> gets called; exactly
+ # once will do). [Bug 987169]
+
set data(okBtn) [::tk::AmpWidget button $f2.ok \
-text "[mc "&OK"]" -default active -pady 3]
+ bind $data(okBtn) <Destroy> [list ::tk::dialog::file::Destroyed $w]
set data(cancelBtn) [::tk::AmpWidget button $f2.cancel \
-text "[mc "&Cancel"]" -default normal -pady 3]
@@ -1112,9 +1117,9 @@ static char updir_bits[] = {
$data(cancelBtn) config -command [list ::tk::dialog::file::CancelCmd $w]
bind $w <KeyPress-Escape> [list tk::ButtonInvoke $data(cancelBtn)]
bind $w <Alt-Key> [list tk::AltKeyInDialog $w %A]
+
# Set up event handlers specific to File or Directory Dialogs
#
-
if { [string equal $class TkFDialog] } {
bind $data(ent) <Return> [list ::tk::dialog::file::ActivateEnt $w]
$data(okBtn) config -command [list ::tk::dialog::file::OkCmd $w]
@@ -1656,6 +1661,16 @@ proc ::tk::dialog::file::CancelCmd {w} {
upvar ::tk::dialog::file::[winfo name $w] data
variable ::tk::Priv
+ $data(okBtn) configure <Destroy> {}
+ set Priv(selectFilePath) ""
+}
+
+# Gets called when user destroys the dialog directly [Bug 987169]
+#
+proc ::tk::dialog::file::Destroyed {w} {
+ upvar ::tk::dialog::file::[winfo name $w] data
+ variable ::tk::Priv
+
set Priv(selectFilePath) ""
}
@@ -1777,5 +1792,6 @@ proc ::tk::dialog::file::Done {w {selectFilePath ""}} {
}
}
}
+ $data(okBtn) configure <Destroy> {}
set Priv(selectFilePath) $selectFilePath
}