TIP #236: ABSOLUTE POSITIONING OF CANVAS ITEMS ================================================ Version: $Revision: 1.10 $ Author: Neil McKay State: Final Type: Project Tcl-Version: 8.6 Vote: Done Created: Saturday, 25 December 2004 URL: https://tip.tcl-lang.org236.html Post-History: ------------------------------------------------------------------------- ABSTRACT ========== This TIP proposes adding a canvas widget command to set the absolute position of canvas items. 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 *move* command to translate the items to where we want them. This is tedious and inefficient. THE 'MOVETO' CANVAS COMMAND ============================= This TIP proposes adding a subcommand called *moveto* to the canvas widget command. It is analogous to the canvas *move* command, except that it accepts an absolute position instead of a relative displacement. For instance, the command .c moveto stuff 100 200 will displace all items tagged with /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. FORMAL SYNTAX --------------- /canvas/ *moveto* /tagOrId/ /x/ /y/ Argument description: canvas: The canvas instance's command. tagOrId: A specifier that selects one or more items. If no items are selected, the command does nothing. x, y: The absolute coordinates of the target location. If either coordinate is given as an empty string, then that coordinate will remain unchanged. PATCHES ========= A patch (against tcl8.5a3) that implements the *moveto* canvas subcommand is available []. COPYRIGHT =========== This document is in the public domain. ------------------------------------------------------------------------- TIP AutoGenerator - written by Donal K. Fellows