diff options
author | fvogel <fvogelnew1@free.fr> | 2016-10-30 18:03:42 (GMT) |
---|---|---|
committer | fvogel <fvogelnew1@free.fr> | 2016-10-30 18:03:42 (GMT) |
commit | 3bbc7a3606807a480a7343dcb0e9962cb5a2c2a7 (patch) | |
tree | d8e3fcf0e54904098a69830a8b0f01ae98d12eba | |
parent | 3018168a3e0557e975297dc25d9906c6c201b0ed (diff) | |
parent | fa9df7b1d04b12846e08d6bd9c0961629f30e222 (diff) | |
download | tk-3bbc7a3606807a480a7343dcb0e9962cb5a2c2a7.zip tk-3bbc7a3606807a480a7343dcb0e9962cb5a2c2a7.tar.gz tk-3bbc7a3606807a480a7343dcb0e9962cb5a2c2a7.tar.bz2 |
Fixed [3588460fff] - -typevariable buggy in X11
-rw-r--r-- | library/tkfbox.tcl | 5 | ||||
-rw-r--r-- | library/xmfbox.tcl | 9 | ||||
-rw-r--r-- | tests/filebox.test | 2 |
3 files changed, 10 insertions, 6 deletions
diff --git a/library/tkfbox.tcl b/library/tkfbox.tcl index a52465a..f73fdc5 100644 --- a/library/tkfbox.tcl +++ b/library/tkfbox.tcl @@ -310,6 +310,7 @@ proc ::tk::dialog::file::Config {dataName type argList} { # 5. Parse the -filetypes option # + set data(origfiletypes) $data(-filetypes) set data(-filetypes) [::tk::FDGetFileTypes $data(-filetypes)] if {![winfo exists $data(-parent)]} { @@ -1119,7 +1120,9 @@ proc ::tk::dialog::file::Done {w {selectFilePath ""}} { && [info exists data(filterType)] && $data(filterType) ne "" } then { upvar #0 $data(-typevariable) typeVariable - set typeVariable [lindex $data(filterType) 0] + set typeVariable [lindex $data(origfiletypes) \ + [lsearch -exact $data(-filetypes) $data(filterType)] 0] + } } bind $data(okBtn) <Destroy> {} diff --git a/library/xmfbox.tcl b/library/xmfbox.tcl index aa66f7f..14d2be5 100644 --- a/library/xmfbox.tcl +++ b/library/xmfbox.tcl @@ -156,7 +156,7 @@ proc ::tk::MotifFDialog_FileTypes {w} { # The filetypes radiobuttons # set data(fileType) $data(-defaulttype) # Default type to first entry - set initialTypeName [lindex $data(-filetypes) 0 0] + set initialTypeName [lindex $data(origfiletypes) 0 0] if {$data(-typevariable) ne ""} { upvar #0 $data(-typevariable) typeVariable if {[info exists typeVariable]} { @@ -165,7 +165,7 @@ proc ::tk::MotifFDialog_FileTypes {w} { } set ix 0 set data(fileType) 0 - foreach fltr $data(-filetypes) { + foreach fltr $data(origfiletypes) { set fname [lindex $fltr 0] if {[string first $initialTypeName $fname] == 0} { set data(fileType) $ix @@ -185,7 +185,7 @@ proc ::tk::MotifFDialog_FileTypes {w} { set cnt 0 if {$data(-filetypes) ne {}} { foreach type $data(-filetypes) { - set title [lindex [lindex $type 0] 0] + set title [lindex $type 0] set filter [lindex $type 1] radiobutton $f.b$cnt \ -text $title \ @@ -299,6 +299,7 @@ proc ::tk::MotifFDialog_Config {dataName type argList} { # file dialog, but we check for validity of the value to make sure # the application code also runs fine with the TK file dialog. # + set data(origfiletypes) $data(-filetypes) set data(-filetypes) [::tk::FDGetFileTypes $data(-filetypes)] if {![info exists data(filter)]} { @@ -870,7 +871,7 @@ proc ::tk::MotifFDialog_ActivateSEnt {w} { if {[info exists data(-typevariable)] && $data(-typevariable) ne "" && [info exists data(-filetypes)] && $data(-filetypes) ne ""} { upvar #0 $data(-typevariable) typeVariable - set typeVariable [lindex $data(-filetypes) $data(fileType) 0] + set typeVariable [lindex $data(origfiletypes) $data(fileType) 0] } if {$data(-multiple) != 0} { diff --git a/tests/filebox.test b/tests/filebox.test index 2573825..2f87c3e 100644 --- a/tests/filebox.test +++ b/tests/filebox.test @@ -281,7 +281,7 @@ foreach mode $modes { -initialfile $fileName -initialdir $fileDir \ -typevariable tv] if {[info exists tv]} { - regexp {^(.*) \(.*\)$} $tv dummy typeName + set typeName $tv } else { set typeName "-unset-" } |