From: Kevin W. <kw...@co...> - 2017-05-01 02:11:29
|
Hi all, I've just commited an update that restores proper file filtering in tk_getOpenFile in Tk-Cocoa. This functionality had been pretty much broken since the transition from Carbon, because the Cocoa dialogs don't support file filtering out of the box the way the Carbon dialogs did. After some prompting from Torsten Reincke and Christian Gollwitzer, I took another look and found the functionality wasn't too hard to implement based on some sample code I found in a blog. To test, you'll need to update core-8-6-branch or trunk from Fossil and build. Then, please run the following script: set types { {{Text Files} {.txt} } {{TCL Scripts} {.tcl} } {{C Source Files} {.c} TEXT} {{GIF Files} {.gif} } {{GIF Files} {} GIFF} {{All Files} * } } set filename [tk_getOpenFile -filetypes $types] This will load a open panel that displays all listed file types. To access the filter menu, you'll have to click on the "options" button that is displayed in the bottom of the window. This will load the filter button. Then, if you select one of the entries, only those entries in the dialog will be displayed for selection. As Don Porter has not yet announced release candidates of Tcl/Tk 8.6.7, I expect these changes will make it into the next release of Tk. Thanks, Kevin -- Kevin Walzer Code by Kevin/Mobile Code by Kevin http://www.codebykevin.com http://www.wtmobilesoftware.com |