\documentclass[]{article}
\usepackage{amsmath,graphicx,supertabular,hyperref,tabularx,ifthen}
\title{TIP \#382: Let tk\_getSaveFile ignore file overwrites}
\date{November 02, 2010}
\author{Pawel Salawa, Don Porter}
\urlstyle{sf}
\setlength{\parskip}{1ex}
\setlength{\parindent}{0pt}
\def\tipversion$#1${\texttt{\$#1\$}}
\def\tiplangle#1{\ensuremath{<}}
\def\tiprangle#1{\ensuremath{>}}
\def\tipbar#1{\ensuremath{|}}
\def\tipmail#1#2{\(\langle\){\small\expandafter\url{#1@#2}}\(\rangle\)}
\ifx\pdfoutput\undefined
\newcommand{\tipimage}[2]{\typeout{Make sure you download #1.eps}\ifthenelse{\lengthtest{0.8\textwidth>#2}\and\lengthtest{0pt<#2}}{\includegraphics{#1.eps}}{\includegraphics[width=0.8\textwidth]{#1.eps}}}
\newcommand{\tipxref}[1]{}
\newcommand{\tipxrefend}{}
\else
\newcommand{\tipimage}[2]{\typeout{Make sure you create #1.pdf}\ifthenelse{\lengthtest{0.8\textwidth>#2}\and\lengthtest{0pt<#2}}{\includegraphics{#1.pdf}}{\includegraphics[width=0.8\textwidth]{#1.pdf}}}
\pdfcatalog{/PageMode /UseOutlines}
\newcommand{\tipxref}[1]{\pdfannotlink attr {/C [0.5 0.5 1.0] /Border [0 0 1]} goto name {#1}}
\newcommand{\tipxrefend}{\pdfendlink}
\fi
\newenvironment{tipabstract}{\begin{abstract}}{\end{abstract}}
\begin{document}\maketitle
\begin{center}\begin{tabularx}{\linewidth}{|r@{: }X|}\hline
\textbf{TIP \#382}&\textbf{Let tk\_getSaveFile ignore file overwrites}\\\hline
Author&

Pawel Salawa \tipmail{pawelsalawa}{gmail.com}
\par
Don Porter \tipmail{dgp}{users.sourceforge.net}
\\
Created&Tuesday, \(\text{2}^{\text{nd}}\) November 2010\\
Type&Project\\
Tcl Version&\(8.5.11\)\\
State&Final\\
Vote&Done\\
Version&\tipversion$Revision: 1.6 $\\
Keywords&Tk, dialog\\
Post History&\\
\hline\end{tabularx}\end{center}
\thispagestyle{empty}\pagestyle{empty}
\begin{tipabstract}

This document describes new option for \textbf{tk\_getSaveFile} named \textbf{-confirmoverwrite} to control whether a warning dialog is displayed when selecting an existing file for overwriting.
\end{tipabstract}
\tableofcontents\setcounter{page}{0}\clearpage\pagestyle{plain}

\section{Rationale}

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 \textbf{ttk::getAppendFile} from \url{http://wiki.tcl.tk/15897}, but it used its own file dialog, instead of native one. This TIP makes use of native file dialog.

\section{Specification}

The \textbf{tk\_getSaveFile} will accept a \textbf{-confirmoverwrite} option with boolean value as its argument. Default value for this option is ``\textbf{true}''. If value for this option is ``\textbf{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 \textbf{tk\_getSaveFile}, not for \textbf{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.

\section{Compatibility}

Default value matches existing behavior. 

\section{Reference Implementation}

See the \textbf{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 [\url{http://stackoverflow.com/questions/1930352/nssavepanel-squelching-the-confirm-replace-dialog/2390780\#2390780}], but no such implementation is yet completed.

\section{Copyright}

This document has been placed in the public domain.

\section{Colophon}

\textit{TIP AutoGenerator --- written by Donal K. Fellows}
\end{document}
