Author: Pawel Salawa <email@example.com> Author: Don Porter <firstname.lastname@example.org> State: Final Type: Project Tcl-Version: 8.5.11 Vote: Done Created: 02-Nov-2010 Post-History: Keywords: Tk, dialog Tk-Branch: tip-382
This document describes new option for tk_getSaveFile named -confirmoverwrite to control whether a warning dialog is displayed when selecting an existing file for overwriting.
There's been numerous requests for support for file dialog that allows to select a file name with no matter if it exists or not. One workaround was to use ttk::getAppendFile from http://wiki.tcl.tk/15897, but it used its own file dialog, instead of native one. This TIP makes use of native file dialog.
The tk_getSaveFile will accept a -confirmoverwrite option with boolean value as its argument. Default value for this option is "true". If value for this option is "false", then the dialog won't warn user in case he selects existing file, that he's about to overwrite the file. The option will be supported only for tk_getSaveFile, not for tk_getOpenFile. A non-boolean value for this option will raise an error.
The new option will be recognized and accepted on all platforms. For any platform where the underlying windowing system does not permit the required configuration, the option will have no effect, and the platform dialog will just do what it does.
Default value matches existing behavior.
See the tip-382 branch. It includes implementations for X, supported Windows, and OSX Carbon. The proposed option will not be implemented for Pre-NT Windows. An implementation for OSX Cocoa may be possible using the approach outlined at http://stackoverflow.com/questions/1930352/nssavepanel-squelching-the-confirm-replace-dialog/2390780#2390780 , but no such implementation is yet completed.
This document has been placed in the public domain.