TIP #382: Let tk_getSaveFile ignore file overwrites

Title:Let tk_getSaveFile ignore file overwrites
Version:$Revision: 1.6 $
Authors: Pawel Salawa <pawelsalawa at gmail dot com>
Don Porter <dgp at users dot sourceforge dot net>
Created:Tuesday, 02 November 2010
Keywords:Tk, dialog


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.

Reference Implementation

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 [1], but no such implementation is yet completed.


This document has been placed in the public domain.

Powered by Tcl[Index] [History] [HTML Format] [Source Format] [LaTeX Format] [Text Format] [XML Format] [*roff Format (experimental)] [RTF Format (experimental)]

TIP AutoGenerator - written by Donal K. Fellows