From: SourceForge.net <no...@so...> - 2008-06-13 15:56:41
|
Bugs item #1614032, was opened at 2006-12-12 16:27 Message generated for change (Comment added) made by jose-v You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=112997&aid=1614032&group_id=12997 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: 37. [tk_get*File] Group: obsolete: 8.5b2 Status: Open Resolution: None Priority: 8 Private: No Submitted By: Enrico SEGRE (ensegre) Assigned to: Jeffrey Hobbs (hobbs) Summary: tk_getOpenFile (linux) can't select files and dirs Initial Comment: Since tk_getOpenFile -multiple 1 can select simultaneously files and directory entries, I would expect it to return the list of the selected items. Instead: -on win98/winxp it returns only the file items -on linux (FC5, tk 8.4.13-1.1) if, say, path1/file1 and path1/dir1 are selected [path1 being the directory whose contents are shown in the widget], it fails, first complaining about a nonexisting path1/dir1/file1 in an untitled messagebox, then redisplaying the chooser widget on dir1 (as for multiple 0/ open when dir1 is selected) If I have 2 files and one dir selected, I manage to get as the result the two filenames plus the name of one file within dir1, or, at times, the following Application Error: can't read "itemList()": no such element in array can't read "itemList()": no such element in array while executing "foreach {iTag tTag text serial} $itemList($rTag) { break }" (procedure "::tk::IconList_Get" line 5) invoked from within "::tk::IconList_Get $data(icons) $item" (procedure "::tk::dialog::file::ActivateEnt" line 18) invoked from within "::tk::dialog::file::ActivateEnt $w" (procedure "::tk::dialog::file::OkCmd" line 18) invoked from within "::tk::dialog::file::OkCmd .__tk_filedialog" invoked from within ".__tk_filedialog.f2.ok invoke" ("uplevel" body line 1) invoked from within "uplevel #0 [list $w invoke]" (procedure "tk::ButtonUp" line 22) invoked from within "tk::ButtonUp .__tk_filedialog.f2.ok" (command bound to event) ---------------------------------------------------------------------- Comment By: Jose Vina (jose-v) Date: 2008-06-13 17:56 Message: Logged In: YES user_id=1157211 Originator: NO The problem seems to be that, after selecting multiple files in the file dialog, clicking the OK button (Open) removes the Icon selection. Because the multiple file counting relies on these selected icons, the program doesn't notice a multiple selection but considers that all the concatenated names is a single file name string... Do this test: select multiple files, and click-and-hold the "Open" button (do not release the mouse button). Notice the difference: In 8.4, clicking okBtn didn't clear the icon selection. In 8.5, clicking okBtn triggers ::tk::IconList_FocusOut too early. That clears the icon selection! ---------------------------------------------------------------------- Comment By: Jose Vina (jose-v) Date: 2008-04-04 17:17 Message: Logged In: YES user_id=1157211 Originator: NO I've tried the suggested patch on 8.5.1 and it didn't help. The FILE case of that switch in ::tk::dialog::file::VerifyFileName seems to be executed, and I get the error popup saying 'File "/dir/file1 file2" does not exist' when I try to open two files (file1 and file1) from the same directory (dir). Clearly the many elements in the multiple selection are not correctly handled, and the Verifier is fooled by it. ---------------------------------------------------------------------- Comment By: fvogelnew1 (fvogelnew1) Date: 2006-12-17 22:47 Message: Logged In: YES user_id=1245417 Originator: NO I think I have sufficiently analyzed this problem to derive a patch for the core_8.4.14 branch, and another one for the HEAD (8.5) branch. The only impacted file is library/tkfbox.tcl Please check it and apply it to the source tree if everything is OK for you. Francois -------- patch_for_tkfbox.tcl_core_8.4.14 ----------- --- C:\Documents and Settings\François\Bureau\Multiple file open\tkfbox.tcl.core_8.4.14_(rev.1.38.2.12) Sun Dec 17 22:32:20 2006 +++ C:\Documents and Settings\François\Bureau\Multiple file open\tkfbox.tcl.fixed_against.core_8.4.14 Sun Dec 17 22:26:40 2006 @@ -1563,9 +1563,14 @@ switch -- $flag { OK { if {$file eq ""} { - # user has entered an existing (sub)directory - set data(selectPath) $path - $data(ent) delete 0 end + # user has entered an existing (sub)directory + if {!$data(-multiple)} { + set data(selectPath) $path + $data(ent) delete 0 end + } else { + lappend data(selectFile) $path + ::tk::dialog::file::Done $w + } } else { ::tk::dialog::file::SetPathSilently $w $path if {$data(-multiple)} { -------- patch_for_tkfbox.tcl_HEAD ----------- --- C:\Documents and Settings\François\Bureau\Multiple file open\tkfbox.tcl.HEAD_(rev.1.58) Sun Dec 17 22:32:56 2006 +++ C:\Documents and Settings\François\Bureau\Multiple file open\tkfbox.tcl.fixed_against.HEAD Sun Dec 17 22:37:37 2006 @@ -1601,9 +1601,14 @@ switch -- $flag { OK { if {$file eq ""} { - # user has entered an existing (sub)directory - set data(selectPath) $path - $data(ent) delete 0 end + # user has entered an existing (sub)directory + if {!$data(-multiple)} { + set data(selectPath) $path + $data(ent) delete 0 end + } else { + lappend data(selectFile) $path + ::tk::dialog::file::Done $w + } } else { SetPathSilently $w $path if {$data(-multiple)} { ----------------------------------------------------------------- ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=112997&aid=1614032&group_id=12997 |