\documentclass[]{article}
\usepackage{amsmath,graphicx,supertabular,hyperref,tabularx,ifthen}
\title{TIP \#236: Absolute Positioning of Canvas Items}
\date{December 25, 2004}
\author{Neil McKay}
\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 \#236}&\textbf{Absolute Positioning of Canvas Items}\\\hline
Author&

Neil McKay \tipmail{mckay}{eecs.umich.edu}
\\
Created&Saturday, \(\text{25}^{\text{th}}\) December 2004\\
Type&Project\\
Tcl Version&\(8.6\)\\
State&Final\\
Vote&Done\\
Version&\tipversion$Revision: 1.10 $\\
Keywords&Tk, anchor, place\\
Post History&\\
\hline\end{tabularx}\end{center}
\thispagestyle{empty}\pagestyle{empty}
\begin{tipabstract}

This TIP proposes adding a canvas widget command to set the absolute position of canvas items.
\end{tipabstract}
\tableofcontents\setcounter{page}{0}\clearpage\pagestyle{plain}

\section{Rationale}

There are many situations where it is desirable to move a group of canvas items to a given position. Currently, this is done by getting the items' first coordinate, calculating the offset required to move the items to the desired position, and using the canvas \textbf{move} command to translate the items to where we want them. This is tedious and inefficient.

\section{The 'moveto' Canvas Command}

This TIP proposes adding a subcommand called \textbf{moveto} to the canvas widget command. It is analogous to the canvas \textbf{move} command, except that it accepts an absolute position instead of a relative displacement. For instance, the command
\begingroup\small\begin{verbatim}
	.c moveto stuff 100 200
\end{verbatim}
\endgroup

will displace all items tagged with \textit{stuff} so that the first coordinate of the first (bottom-most) tagged item lies at the point (100,200).

The result of the command will be the empty string.

\subsection{Formal Syntax}

\begin{quote}
\textit{canvas} \textbf{moveto} \textit{tagOrId} \textit{x} \textit{y}
\end{quote}

Argument description:
\begin{description}
\item[canvas]
The canvas instance's command.
\item[tagOrId]
A specifier that selects one or more items. If no items are selected, the command does nothing.
\item[x, y]
The absolute coordinates of the target location. If either coordinate is given as an empty string, then that coordinate will remain unchanged.
\end{description}

\section{Patches}

A patch (against tcl8.5a3) that implements the \textbf{moveto} canvas subcommand is available [\url{http://www.eecs.umich.edu/~mckay/canvmoveto.patch.gz}].

\section{Copyright}

This document is in the public domain.

\section{Colophon}

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