\documentclass[]{article}
\usepackage{amsmath,graphicx,supertabular,hyperref,tabularx,ifthen}
\title{TIP \#25: Native tk\_messageBox  on Macintosh}
\date{February 07, 2001}
\author{Mats Bengtsson}
\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 \#25}&\textbf{Native tk\_messageBox  on Macintosh}\\\hline
Author&

Mats Bengtsson \tipmail{matben}{privat.utfors.se}
\\
Created&Wednesday, \(\text{7}^{\text{th}}\) February 2001\\
Type&Project\\
Tcl Version&\(8.5\)\\
State&Withdrawn\\
Vote&Pending\\
Version&\tipversion$Revision: 1.3 $\\
Obsoleted By&152\\
Post History&\\
\hline\end{tabularx}\end{center}
\thispagestyle{empty}\pagestyle{empty}
\begin{tipabstract}

This is a replacement for the \textit{tk\_messageBox} on the Macintosh with a native implementation which is compliant with the Appearance Manager in Mac OS 8 and later.
\end{tipabstract}
\tableofcontents\setcounter{page}{0}\clearpage\pagestyle{plain}

\section{Rationale}

The present (in 8.3.2p1 and earlier) \textit{tk\_messageBox} on the Macintosh is non-movable, and lacks many features that are required to be compliant with Mac OS 8 and later. Non-movable dialogs should be abandoned in a multitasking environment. This TIP presents a step to extend the native appearance on the Macintosh.

\begin{figure}[htbp]\begin{center}\leavevmode
\tipimage{25original}{236pt}
\caption{This is the present tk\_messageBox.}
\end{center}\end{figure}

\begin{figure}[htbp]\begin{center}\leavevmode
\tipimage{25native}{376pt}
\caption{This is the native tk\_messageBox.}
\end{center}\end{figure}

\section{Reference Implementation}

The proposed change is now implemented as a loadable extension (in C) on Macintosh, and can be downloaded at \url{http://hem.fyristorg.com/matben/download/MovableAlerts.sit} . This extension requires Tk 8.3.2p1 or later due to the changed stub loading mechanism. The core of the code should go in the \textit{tkMacDialog.c} file. Some additional changes are necessary in order to load the new \textit{tk\_messageBox} and not the old, script based \textit{tk\_messageBox}. Also, need to check for the presence of the Appearance manager:
\begingroup\small\begin{verbatim}
if (Appearance Manager)
    use native (new) messageBox
else
    use present script based messageBox
\end{verbatim}
\endgroup

All functionality from the documentation that are applicable are implemented, with some exceptions:
\begin{itemize}
\item{}
 There is a \textit{-finemessage} option to support the native text message set in a smaller font below the main message.
\item{}
 Both \textit{-message} and \textit{-finemessage} option are truncated at 255 characters.
\item{}
 Buttons appear from right to left instead of vice versa.
\item{}
 There is always a default button. 
\end{itemize}

All these deviations are consistent with the look-and-feel of Mac OS 8.0 and on. Existing scripts using \textit{tk\_messageBox} are compatible with the new \textit{tk\_messageBox}.

Open questions: 
\begin{itemize}
\item{}
 Name of extra option \textit{-finemessage}
\item{}
Name of the two C functions in the implementation
\item{}
How to make the core code call the new code instead of the original, script implemented
\end{itemize}

\section{Copyright}

This document has been placed in the public domain

\section{Colophon}

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