<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE TIP SYSTEM "http://tcl.activestate.com/cgi-bin/tct/tip/tipxml.dtd">
<!-- Converted at Wed May 16 19:59:23 GMT 2012 -->
<!-- TIP AutoGenerator - written by Donal K. Fellows -->

<TIP number='236'>
<header><title>Absolute Positioning of Canvas Items</title><author address="mailto:mckay@eecs.umich.edu">Neil McKay</author><status type='project' state='final' tclversion="8.6" vote='after'>$Revision: 1.10 $</status><history></history><created day='25' month='dec' year='2004' /><keyword>Tk anchor place</keyword></header>
<abstract>This TIP proposes adding a canvas widget command to set the absolute position of canvas items.</abstract>
<body><section title="Rationale">
<para>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&apos; first coordinate, calculating the offset required to move the items to the desired position, and using the canvas <emph style="bold">move</emph> command to translate the items to where we want them. This is tedious and inefficient.</para>
</section>
<section title="The &apos;moveto&apos; Canvas Command">
<para>This TIP proposes adding a subcommand called <emph style="bold">moveto</emph> to the canvas widget command. It is analogous to the canvas <emph style="bold">move</emph> command, except that it accepts an absolute position instead of a relative displacement. For instance, the command</para>
<verbatim><vline encoding='base64'>CS5jIG1vdmV0byBzdHVmZiAxMDAgMjAw</vline></verbatim>
<para>will displace all items tagged with <emph style="italic">stuff</emph> so that the first coordinate of the first (bottom-most) tagged item lies at the point (100,200).</para>
<para>The result of the command will be the empty string.</para>
<subsection title="Formal Syntax">
<quote><emph style="italic">canvas</emph> <emph style="bold">moveto</emph> <emph style="italic">tagOrId</emph> <emph style="italic">x</emph> <emph style="italic">y</emph></quote>
<para>Argument description:</para>
<describe><item.d name='canvas'><para>The canvas instance&apos;s command.</para></item.d><item.d name='tagOrId'><para>A specifier that selects one or more items. If no items are selected, the command does nothing.</para></item.d><item.d name='x, y'><para>The absolute coordinates of the target location. If either coordinate is given as an empty string, then that coordinate will remain unchanged.</para></item.d></describe>
</subsection>
</section>
<section title="Patches">
<para>A patch (against tcl8.5a3) that implements the <emph style="bold">moveto</emph> canvas subcommand is available [<url ref="http://www.eecs.umich.edu/~mckay/canvmoveto.patch.gz"/>].</para>
</section>
<section title="Copyright">
<para>This document is in the public domain.</para>
</section>
</body></TIP>

