|
From: SourceForge.net <no...@so...> - 2011-09-27 20:09:03
|
Bugs item #3414695, was opened at 2011-09-27 22:09 Message generated for change (Tracker Item Submitted) made by zbigniew_b You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=112997&aid=3414695&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: 36. [tk_chooseDirectory] Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Zbigniew (zbigniew_b) Assigned to: Jeffrey Hobbs (hobbs) Summary: Error when "parent" destroyed first Initial Comment: I think, there is a need for a fix in tk_chooseDirectory, tk_getOpenFile, tk_getSaveFile. Consider the situation, when toplevel dialog has been brought, and there is an entry for file (or directory) name, and associated button, which allows selection using mouse, instead of typing. Below is much simplified example, which will show the problem: #v+ package require Tk toplevel .foo pack [button .foo.button -command [list tk_getOpenFile -parent .foo] \ -text "Pick file"] #v- Now, if you click "Pick file" to select the wanted file with mouse, then you'll change your mind, and decide to abort the whole operation just by closing .foo (and _not_ by closing selection window first, then .foo), an error will be raised: #v+ bad window path name ".foo.__tk_filedialog" bad window path name ".foo.__tk_filedialog" while executing "wm withdraw $grab" (procedure "::tk::RestoreFocusGrab" line 13) invoked from within "::tk::RestoreFocusGrab $w $data(ent) withdraw" (procedure "::tk::dialog::file::" line 122) invoked from within "::tk::dialog::file:: open -parent .foo" invoked from within ".foo.button invoke" ("uplevel" body line 1) invoked from within "uplevel #0 [list $w invoke]" (procedure "tk::ButtonUp" line 22) invoked from within "tk::ButtonUp .foo.button" (command bound to event) #v- Of course, I made this "not quite elegant" way, not closing selection window first - but pay attention, that only in this example the parent toplevel was smaller than its child; in real applications usually it'll be much larger, and we can expect such action from the side of the (lazy) user. IMHO there should be such (mis)use foreseen and silently handled. Tested on Linux using TCL/Tk 8.6b2. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=112997&aid=3414695&group_id=12997 |