summaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
authordas <das>2007-10-26 08:04:15 (GMT)
committerdas <das>2007-10-26 08:04:15 (GMT)
commit1984cb42d523879f6d9400705eb94b96627714cd (patch)
treee88c48cb5728559d5a2d8757514c9764436e23b1 /library
parenta220ddc7b2805c63cd68bddcdba097b7f37c3372 (diff)
downloadtk-1984cb42d523879f6d9400705eb94b96627714cd.zip
tk-1984cb42d523879f6d9400705eb94b96627714cd.tar.gz
tk-1984cb42d523879f6d9400705eb94b96627714cd.tar.bz2
use global for -typevariable
Diffstat (limited to 'library')
-rw-r--r--library/demos/filebox.tcl11
1 files changed, 7 insertions, 4 deletions
diff --git a/library/demos/filebox.tcl b/library/demos/filebox.tcl
index c64888e..209eb66 100644
--- a/library/demos/filebox.tcl
+++ b/library/demos/filebox.tcl
@@ -2,7 +2,7 @@
#
# This demonstration script prompts the user to select a file.
#
-# RCS: @(#) $Id: filebox.tcl,v 1.7 2007/10/26 07:56:02 das Exp $
+# RCS: @(#) $Id: filebox.tcl,v 1.8 2007/10/26 08:04:15 das Exp $
if {![info exists widgetDemo]} {
error "This script should be run from the \"widget\" demo."
@@ -61,10 +61,13 @@ proc fileDialog {w ent operation} {
{"All files" *}
}
if {$operation == "open"} {
- set type "Tcl Scripts"
+ global selected_type
+ if {![info exists selected_type]} {
+ set selected_type "Tcl Scripts"
+ }
set file [tk_getOpenFile -filetypes $types -parent $w \
- -typevariable type]
- puts "You selected filetype \"$type\""
+ -typevariable selected_type]
+ puts "You selected filetype \"$selected_type\""
} else {
set file [tk_getSaveFile -filetypes $types -parent $w \
-initialfile Untitled -defaultextension .txt]