Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / tools / src / nas,5.n2.os.2 / lib / python / man / mann / canvas.n
CommitLineData
86530b38
AT
1'\"
2'\" Copyright (c) 1992-1994 The Regents of the University of California.
3'\" Copyright (c) 1994-1996 Sun Microsystems, Inc.
4'\" Copyright (c) 1997-1999 Scriptics Corporation.
5'\"
6'\" See the file "license.terms" for information on usage and redistribution
7'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
8'\"
9'\" RCS: @(#) $Id: canvas.n,v 1.13.2.2 2005/05/12 22:50:59 dgp Exp $
10'\"
11'\" The definitions below are for supplemental macros used in Tcl/Tk
12'\" manual entries.
13'\"
14'\" .AP type name in/out ?indent?
15'\" Start paragraph describing an argument to a library procedure.
16'\" type is type of argument (int, etc.), in/out is either "in", "out",
17'\" or "in/out" to describe whether procedure reads or modifies arg,
18'\" and indent is equivalent to second arg of .IP (shouldn't ever be
19'\" needed; use .AS below instead)
20'\"
21'\" .AS ?type? ?name?
22'\" Give maximum sizes of arguments for setting tab stops. Type and
23'\" name are examples of largest possible arguments that will be passed
24'\" to .AP later. If args are omitted, default tab stops are used.
25'\"
26'\" .BS
27'\" Start box enclosure. From here until next .BE, everything will be
28'\" enclosed in one large box.
29'\"
30'\" .BE
31'\" End of box enclosure.
32'\"
33'\" .CS
34'\" Begin code excerpt.
35'\"
36'\" .CE
37'\" End code excerpt.
38'\"
39'\" .VS ?version? ?br?
40'\" Begin vertical sidebar, for use in marking newly-changed parts
41'\" of man pages. The first argument is ignored and used for recording
42'\" the version when the .VS was added, so that the sidebars can be
43'\" found and removed when they reach a certain age. If another argument
44'\" is present, then a line break is forced before starting the sidebar.
45'\"
46'\" .VE
47'\" End of vertical sidebar.
48'\"
49'\" .DS
50'\" Begin an indented unfilled display.
51'\"
52'\" .DE
53'\" End of indented unfilled display.
54'\"
55'\" .SO
56'\" Start of list of standard options for a Tk widget. The
57'\" options follow on successive lines, in four columns separated
58'\" by tabs.
59'\"
60'\" .SE
61'\" End of list of standard options for a Tk widget.
62'\"
63'\" .OP cmdName dbName dbClass
64'\" Start of description of a specific option. cmdName gives the
65'\" option's name as specified in the class command, dbName gives
66'\" the option's name in the option database, and dbClass gives
67'\" the option's class in the option database.
68'\"
69'\" .UL arg1 arg2
70'\" Print arg1 underlined, then print arg2 normally.
71'\"
72'\" RCS: @(#) $Id: man.macros,v 1.4 2000/08/25 06:18:32 ericm Exp $
73'\"
74'\" # Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
75.if t .wh -1.3i ^B
76.nr ^l \n(.l
77.ad b
78'\" # Start an argument description
79.de AP
80.ie !"\\$4"" .TP \\$4
81.el \{\
82. ie !"\\$2"" .TP \\n()Cu
83. el .TP 15
84.\}
85.ta \\n()Au \\n()Bu
86.ie !"\\$3"" \{\
87\&\\$1 \\fI\\$2\\fP (\\$3)
88.\".b
89.\}
90.el \{\
91.br
92.ie !"\\$2"" \{\
93\&\\$1 \\fI\\$2\\fP
94.\}
95.el \{\
96\&\\fI\\$1\\fP
97.\}
98.\}
99..
100'\" # define tabbing values for .AP
101.de AS
102.nr )A 10n
103.if !"\\$1"" .nr )A \\w'\\$1'u+3n
104.nr )B \\n()Au+15n
105.\"
106.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
107.nr )C \\n()Bu+\\w'(in/out)'u+2n
108..
109.AS Tcl_Interp Tcl_CreateInterp in/out
110'\" # BS - start boxed text
111'\" # ^y = starting y location
112'\" # ^b = 1
113.de BS
114.br
115.mk ^y
116.nr ^b 1u
117.if n .nf
118.if n .ti 0
119.if n \l'\\n(.lu\(ul'
120.if n .fi
121..
122'\" # BE - end boxed text (draw box now)
123.de BE
124.nf
125.ti 0
126.mk ^t
127.ie n \l'\\n(^lu\(ul'
128.el \{\
129.\" Draw four-sided box normally, but don't draw top of
130.\" box if the box started on an earlier page.
131.ie !\\n(^b-1 \{\
132\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
133.\}
134.el \}\
135\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
136.\}
137.\}
138.fi
139.br
140.nr ^b 0
141..
142'\" # VS - start vertical sidebar
143'\" # ^Y = starting y location
144'\" # ^v = 1 (for troff; for nroff this doesn't matter)
145.de VS
146.if !"\\$2"" .br
147.mk ^Y
148.ie n 'mc \s12\(br\s0
149.el .nr ^v 1u
150..
151'\" # VE - end of vertical sidebar
152.de VE
153.ie n 'mc
154.el \{\
155.ev 2
156.nf
157.ti 0
158.mk ^t
159\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
160.sp -1
161.fi
162.ev
163.\}
164.nr ^v 0
165..
166'\" # Special macro to handle page bottom: finish off current
167'\" # box/sidebar if in box/sidebar mode, then invoked standard
168'\" # page bottom macro.
169.de ^B
170.ev 2
171'ti 0
172'nf
173.mk ^t
174.if \\n(^b \{\
175.\" Draw three-sided box if this is the box's first page,
176.\" draw two sides but no top otherwise.
177.ie !\\n(^b-1 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
178.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
179.\}
180.if \\n(^v \{\
181.nr ^x \\n(^tu+1v-\\n(^Yu
182\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
183.\}
184.bp
185'fi
186.ev
187.if \\n(^b \{\
188.mk ^y
189.nr ^b 2
190.\}
191.if \\n(^v \{\
192.mk ^Y
193.\}
194..
195'\" # DS - begin display
196.de DS
197.RS
198.nf
199.sp
200..
201'\" # DE - end display
202.de DE
203.fi
204.RE
205.sp
206..
207'\" # SO - start of list of standard options
208.de SO
209.SH "STANDARD OPTIONS"
210.LP
211.nf
212.ta 5.5c 11c
213.ft B
214..
215'\" # SE - end of list of standard options
216.de SE
217.fi
218.ft R
219.LP
220See the \\fBoptions\\fR manual entry for details on the standard options.
221..
222'\" # OP - start of full description for a single option
223.de OP
224.LP
225.nf
226.ta 4c
227Command-Line Name: \\fB\\$1\\fR
228Database Name: \\fB\\$2\\fR
229Database Class: \\fB\\$3\\fR
230.fi
231.IP
232..
233'\" # CS - begin code excerpt
234.de CS
235.RS
236.nf
237.ta .25i .5i .75i 1i
238..
239'\" # CE - end code excerpt
240.de CE
241.fi
242.RE
243..
244.de UL
245\\$1\l'|0\(ul'\\$2
246..
247.TH canvas n 8.3 Tk "Tk Built-In Commands"
248.BS
249'\" Note: do not modify the .SH NAME line immediately below!
250.SH NAME
251canvas \- Create and manipulate canvas widgets
252.SH SYNOPSIS
253\fBcanvas\fR \fIpathName \fR?\fIoptions\fR?
254.SO
255\-background \-insertborderwidth \-selectborderwidth
256\-borderwidth \-insertofftime \-selectforeground
257\-cursor \-insertontime \-takefocus
258\-highlightbackground \-insertwidth \-xscrollcommand
259\-highlightcolor \-relief \-yscrollcommand
260\-highlightthickness \-state
261\-insertbackground \-selectbackground
262.SE
263.SH "WIDGET-SPECIFIC OPTIONS"
264.OP \-closeenough closeEnough CloseEnough
265Specifies a floating-point value indicating how close the mouse cursor
266must be to an item before it is considered to be ``inside'' the item.
267Defaults to 1.0.
268.OP \-confine confine Confine
269Specifies a boolean value that indicates whether or not it should be
270allowable to set the canvas's view outside the region defined by the
271\fBscrollRegion\fR argument.
272Defaults to true, which means that the view will
273be constrained within the scroll region.
274.OP \-height height Height
275Specifies a desired window height that the canvas widget should request from
276its geometry manager. The value may be specified in any
277of the forms described in the \fBCOORDINATES\fR section below.
278.OP \-scrollregion scrollRegion ScrollRegion
279Specifies a list with four coordinates describing the left, top, right, and
280bottom coordinates of a rectangular region.
281This region is used for scrolling purposes and is considered to be
282the boundary of the information in the canvas.
283Each of the coordinates may be specified
284in any of the forms given in the \fBCOORDINATES\fR section below.
285.OP \-state state State
286Modifies the default state of the canvas where \fIstate\fR may be set to
287one of: \fBnormal\fR, \fBdisabled\fR, or \fBhidden\fR. Individual canvas
288objects all have their own state option which may override the default
289state. Many options can take separate specifications such that the
290appearance of the item can be different in different situations. The
291options that start with \fBactive\fR control the appearence when the mouse
292pointer is over it, while the option starting with \fBdisabled\fR controls
293the appearence when the state is disabled. Canvas items which are
294\fBdisabled\fR will not react to canvas bindings.
295.OP \-width width width
296Specifies a desired window width that the canvas widget should request from
297its geometry manager. The value may be specified in any
298of the forms described in the \fBCOORDINATES\fR section below.
299.OP \-xscrollincrement xScrollIncrement ScrollIncrement
300Specifies an increment for horizontal scrolling, in any of the usual forms
301permitted for screen distances. If the value of this option is greater
302than zero, the horizontal view in the window will be constrained so that
303the canvas x coordinate at the left edge of the window is always an even
304multiple of \fBxScrollIncrement\fR; furthermore, the units for scrolling
305(e.g., the change in view when the left and right arrows of a scrollbar
306are selected) will also be \fBxScrollIncrement\fR. If the value of
307this option is less than or equal to zero, then horizontal scrolling
308is unconstrained.
309.OP \-yscrollincrement yScrollIncrement ScrollIncrement
310Specifies an increment for vertical scrolling, in any of the usual forms
311permitted for screen distances. If the value of this option is greater
312than zero, the vertical view in the window will be constrained so that
313the canvas y coordinate at the top edge of the window is always an even
314multiple of \fByScrollIncrement\fR; furthermore, the units for scrolling
315(e.g., the change in view when the top and bottom arrows of a scrollbar
316are selected) will also be \fByScrollIncrement\fR. If the value of
317this option is less than or equal to zero, then vertical scrolling
318is unconstrained.
319.BE
320
321.SH INTRODUCTION
322.PP
323The \fBcanvas\fR command creates a new window (given
324by the \fIpathName\fR argument) and makes it into a canvas widget.
325Additional options, described above, may be specified on the
326command line or in the option database
327to configure aspects of the canvas such as its colors and 3-D relief.
328The \fBcanvas\fR command returns its
329\fIpathName\fR argument. At the time this command is invoked,
330there must not exist a window named \fIpathName\fR, but
331\fIpathName\fR's parent must exist.
332.PP
333Canvas widgets implement structured graphics.
334A canvas displays any number of \fIitems\fR, which may be things like
335rectangles, circles, lines, and text.
336Items may be manipulated (e.g. moved or re-colored) and commands may
337be associated with items in much the same way that the \fBbind\fR
338command allows commands to be bound to widgets. For example,
339a particular command may be associated with the <Button-1> event
340so that the command is invoked whenever button 1 is pressed with
341the mouse cursor over an item.
342This means that items in a canvas can have behaviors defined by
343the Tcl scripts bound to them.
344.SH "DISPLAY LIST"
345.PP
346The items in a canvas are ordered for purposes of display,
347with the first item in the display list being displayed
348first, followed by the next item in the list, and so on.
349Items later in the display list obscure those that are
350earlier in the display list and are sometimes referred to
351as being ``on top'' of earlier items.
352When a new item is created it is placed at the end of the
353display list, on top of everything else.
354Widget commands may be used to re-arrange the order of the
355display list.
356.PP
357Window items are an exception to the above rules. The underlying
358window systems require them always to be drawn on top of other items.
359In addition, the stacking order of window items
360is not affected by any of the canvas widget commands; you must use
361the \fBraise\fR and \fBlower\fR Tk commands instead.
362.SH "ITEM IDS AND TAGS"
363.PP
364Items in a canvas widget may be named in either of two ways:
365by id or by tag.
366Each item has a unique identifying number, which is assigned to
367that item when it is created. The id of an item never changes
368and id numbers are never re-used within the lifetime of a
369canvas widget.
370.PP
371Each item may also have any number of \fItags\fR associated
372with it. A tag is just a string of characters, and it may
373take any form except that of an integer.
374For example, ``x123'' is OK but ``123'' isn't.
375The same tag may be associated with many different items.
376This is commonly done to group items in various interesting
377ways; for example, all selected items might be given the
378tag ``selected''.
379.PP
380The tag \fBall\fR is implicitly associated with every item
381in the canvas; it may be used to invoke operations on
382all the items in the canvas.
383.PP
384The tag \fBcurrent\fR is managed automatically by Tk;
385it applies to the \fIcurrent item\fR, which is the
386topmost item whose drawn area covers the position of
387the mouse cursor.
388If the mouse is not in the canvas widget or is not over
389an item, then no item has the \fBcurrent\fR tag.
390.PP
391When specifying items in canvas widget commands, if the
392specifier is an integer then it is assumed to refer to
393the single item with that id.
394If the specifier is not an integer, then it is assumed to
395refer to all of the items in the canvas that have a tag
396matching the specifier.
397The symbol \fItagOrId\fR is used below to indicate that
398an argument specifies either an id that selects a single
399item or a tag that selects zero or more items.
400.PP
401\fItagOrId\fR may contain a logical expressions of
402tags by using operators: '&&', '||', '^' '!', and parenthesized
403subexpressions. For example:
404.CS
405 .c find withtag {(a&&!b)||(!a&&b)}
406.CE
407or equivalently:
408.CS
409 .c find withtag {a^b}
410.CE
411will find only those items with either "a" or "b" tags, but not both.
412.PP
413Some widget commands only operate on a single item at a
414time; if \fItagOrId\fR is specified in a way that
415names multiple items, then the normal behavior is for
416the command to use the first (lowest) of these items in
417the display list that is suitable for the command.
418Exceptions are noted in the widget command descriptions
419below.
420.SH "COORDINATES"
421.PP
422All coordinates related to canvases are stored as floating-point
423numbers.
424Coordinates and distances are specified in screen units,
425which are floating-point numbers optionally followed
426by one of several letters.
427If no letter is supplied then the distance is in pixels.
428If the letter is \fBm\fR then the distance is in millimeters on
429the screen; if it is \fBc\fR then the distance is in centimeters;
430\fBi\fR means inches, and \fBp\fR means printers points (1/72 inch).
431Larger y-coordinates refer to points lower on the screen; larger
432x-coordinates refer to points farther to the right.
433.VS
434Coordinates can be specified either as an even number of parameters,
435or as a single list parameter containing an even number of x and y
436coordinate values.
437.VE
438.SH TRANSFORMATIONS
439.PP
440Normally the origin of the canvas coordinate system is at the
441upper-left corner of the window containing the canvas.
442It is possible to adjust the origin of the canvas
443coordinate system relative to the origin of the window using the
444\fBxview\fR and \fByview\fR widget commands; this is typically used
445for scrolling.
446Canvases do not support scaling or rotation of the canvas coordinate
447system relative to the window coordinate system.
448.PP
449Individual items may be moved or scaled using widget commands
450described below, but they may not be rotated.
451.PP
452Note that the default origin of the canvas's visible area is
453coincident with the origin for the whole window as that makes bindings
454using the mouse position easier to work with; you only need to use the
455\fBcanvasx\fR and \fBcanvasy\fR widget commands if you adjust the
456origin of the visible area. However, this also means that any focus
457ring (as controlled by the \fB\-highlightthickness\fR option) and
458window border (as controlled by the \fB\-borderwidth\fR option) must
459be taken into account before you get to the visible area of the
460canvas.
461.SH "INDICES"
462.PP
463Text items support the notion of an \fIindex\fR for identifying
464particular positions within the item.
465In a similar fashion, line and polygon items support \fIindex\fR for
466identifying, inserting and deleting subsets of their coordinates.
467Indices are used for commands such as inserting or deleting
468a range of characters or coordinates, and setting the insertion
469cursor position. An index may be specified in any of a number
470of ways, and different types of items may support different forms
471for specifying indices.
472Text items support the following forms for an index; if you
473define new types of text-like items, it would be advisable to
474support as many of these forms as practical.
475Note that it is possible to refer to the character just after
476the last one in the text item; this is necessary for such
477tasks as inserting new text at the end of the item.
478Lines and Polygons don't support the insertion cursor
479and the selection. Their indices are supposed to be even
480always, because coordinates always appear in pairs.
481.TP 10
482\fInumber\fR
483A decimal number giving the position of the desired character
484within the text item.
4850 refers to the first character, 1 to the next character, and
486so on. If indexes are odd for lines and polygons, they will be
487automatically decremented by one.
488A number less than 0 is treated as if it were zero, and a
489number greater than the length of the text item is treated
490as if it were equal to the length of the text item. For
491polygons, numbers less than 0 or greater then the length
492of the coordinate list will be adjusted by adding or subtracting
493the length until the result is between zero and the length,
494inclusive.
495.TP 10
496\fBend\fR
497Refers to the character or coordinate just after the last one
498in the item (same as the number of characters or coordinates
499in the item).
500.TP 10
501\fBinsert\fR
502Refers to the character just before which the insertion cursor
503is drawn in this item. Not valid for lines and polygons.
504.TP 10
505\fBsel.first\fR
506Refers to the first selected character in the item.
507If the selection isn't in this item then this form is illegal.
508.TP 10
509\fBsel.last\fR
510Refers to the last selected character in the item.
511If the selection isn't in this item then this form is illegal.
512.TP 10
513\fB@\fIx,y\fR
514Refers to the character or coordinate at the point given by \fIx\fR and
515\fIy\fR, where \fIx\fR and \fIy\fR are specified in the coordinate
516system of the canvas.
517If \fIx\fR and \fIy\fR lie outside the coordinates covered by the
518text item, then they refer to the first or last character in the
519line that is closest to the given point.
520.SH "DASH PATTERNS"
521.PP
522Many items support the notion of a dash pattern for outlines.
523.PP
524The first possible syntax is a list of integers. Each element
525represents the number of pixels of a line segment. Only the odd
526segments are drawn using the "outline" color. The other segments
527are drawn transparent.
528.PP
529The second possible syntax is a character list containing only
5305 possible characters \fB[.,-_ ]\fR. The space can be used
531to enlarge the space between other line elements, and can not
532occur as the first position in the string. Some examples:
533 -dash . = -dash {2 4}
534 -dash - = -dash {6 4}
535 -dash -. = -dash {6 4 2 4}
536 -dash -.. = -dash {6 4 2 4 2 4}
537 -dash {. } = -dash {2 8}
538 -dash , = -dash {4 4}
539.PP
540The main difference of this syntax with the previous is that it
541is shape-conserving. This means that all values in the dash
542list will be multiplied by the line width before display. This
543assures that "." will always be displayed as a dot and "-"
544always as a dash regardless of the line width.
545.PP
546On systems which support only a limited set of dash patterns, the dash
547pattern will be displayed as the closest dash pattern that is available.
548For example, on Windows only the first 4 of the above examples are
549available. The last 2 examples will be displayed identically to the first
550one.
551.SH "WIDGET COMMAND"
552.PP
553The \fBcanvas\fR command creates a new Tcl command whose
554name is \fIpathName\fR. This
555command may be used to invoke various
556operations on the widget. It has the following general form:
557.CS
558\fIpathName option \fR?\fIarg arg ...\fR?
559.CE
560\fIOption\fR and the \fIarg\fRs
561determine the exact behavior of the command.
562The following widget commands are possible for canvas widgets:
563.TP
564\fIpathName \fBaddtag \fItag searchSpec \fR?\fIarg arg ...\fR?
565For each item that meets the constraints specified by
566\fIsearchSpec\fR and the \fIarg\fRs, add
567\fItag\fR to the list of tags associated with the item if it
568isn't already present on that list.
569It is possible that no items will satisfy the constraints
570given by \fIsearchSpec\fR and \fIarg\fRs, in which case the
571command has no effect.
572This command returns an empty string as result.
573\fISearchSpec\fR and \fIarg\fR's may take any of the following
574forms:
575.RS
576.TP
577\fBabove \fItagOrId\fR
578Selects the item just after (above) the one given by \fItagOrId\fR
579in the display list.
580If \fItagOrId\fR denotes more than one item, then the last (topmost)
581of these items in the display list is used.
582.TP
583\fBall\fR
584Selects all the items in the canvas.
585.TP
586\fBbelow \fItagOrId\fR
587Selects the item just before (below) the one given by \fItagOrId\fR
588in the display list.
589If \fItagOrId\fR denotes more than one item, then the first (lowest)
590of these items in the display list is used.
591.TP
592\fBclosest \fIx y \fR?\fIhalo\fR? ?\fIstart\fR?
593Selects the item closest to the point given by \fIx\fR and \fIy\fR.
594If more than one item is at the same closest distance (e.g. two
595items overlap the point), then the top-most of these items (the
596last one in the display list) is used.
597If \fIhalo\fR is specified, then it must be a non-negative
598value.
599Any item closer than \fIhalo\fR to the point is considered to
600overlap it.
601The \fIstart\fR argument may be used to step circularly through
602all the closest items.
603If \fIstart\fR is specified, it names an item using a tag or id
604(if by tag, it selects the first item in the display list with
605the given tag).
606Instead of selecting the topmost closest item, this form will
607select the topmost closest item that is below \fIstart\fR in
608the display list; if no such item exists, then the selection
609behaves as if the \fIstart\fR argument had not been specified.
610.TP
611\fBenclosed\fR \fIx1\fR \fIy1\fR \fIx2\fR \fIy2\fR
612Selects all the items completely enclosed within the rectangular
613region given by \fIx1\fR, \fIy1\fR, \fIx2\fR, and \fIy2\fR.
614\fIX1\fR must be no greater then \fIx2\fR and \fIy1\fR must be
615no greater than \fIy2\fR.
616.TP
617\fBoverlapping\fR \fIx1\fR \fIy1\fR \fIx2\fR \fIy2\fR
618Selects all the items that overlap or are enclosed within the
619rectangular region given by \fIx1\fR, \fIy1\fR, \fIx2\fR,
620and \fIy2\fR.
621\fIX1\fR must be no greater then \fIx2\fR and \fIy1\fR must be
622no greater than \fIy2\fR.
623.TP
624\fBwithtag \fItagOrId\fR
625Selects all the items given by \fItagOrId\fR.
626.RE
627.TP
628\fIpathName \fBbbox \fItagOrId\fR ?\fItagOrId tagOrId ...\fR?
629Returns a list with four elements giving an approximate bounding box
630for all the items named by the \fItagOrId\fR arguments.
631The list has the form ``\fIx1 y1 x2 y2\fR'' such that the drawn
632areas of all the named elements are within the region bounded by
633\fIx1\fR on the left, \fIx2\fR on the right, \fIy1\fR on the top,
634and \fIy2\fR on the bottom.
635The return value may overestimate the actual bounding box by
636a few pixels.
637If no items match any of the \fItagOrId\fR arguments or if the
638matching items have empty bounding boxes (i.e. they have nothing
639to display)
640then an empty string is returned.
641.TP
642\fIpathName \fBbind \fItagOrId\fR ?\fIsequence\fR? ?\fIcommand\fR?
643This command associates \fIcommand\fR with all the items given by
644\fItagOrId\fR such that whenever the event sequence given by
645\fIsequence\fR occurs for one of the items the command will
646be invoked.
647This widget command is similar to the \fBbind\fR command except that
648it operates on items in a canvas rather than entire widgets.
649See the \fBbind\fR manual entry for complete details
650on the syntax of \fIsequence\fR and the substitutions performed
651on \fIcommand\fR before invoking it.
652If all arguments are specified then a new binding is created, replacing
653any existing binding for the same \fIsequence\fR and \fItagOrId\fR
654(if the first character of \fIcommand\fR is ``+'' then \fIcommand\fR
655augments an existing binding rather than replacing it).
656In this case the return value is an empty string.
657If \fIcommand\fR is omitted then the command returns the \fIcommand\fR
658associated with \fItagOrId\fR and \fIsequence\fR (an error occurs
659if there is no such binding).
660If both \fIcommand\fR and \fIsequence\fR are omitted then the command
661returns a list of all the sequences for which bindings have been
662defined for \fItagOrId\fR.
663.RS
664.PP
665The only events for which bindings may be specified are those related to
666the mouse and keyboard (such as \fBEnter\fR, \fBLeave\fR,
667\fBButtonPress\fR, \fBMotion\fR, and \fBKeyPress\fR) or virtual events.
668The handling of events in canvases uses the current item defined in ITEM
669IDS AND TAGS above. \fBEnter\fR and \fBLeave\fR events trigger for an
670item when it becomes the current item or ceases to be the current item;
671note that these events are different than \fBEnter\fR and \fBLeave\fR
672events for windows. Mouse-related events are directed to the current
673item, if any. Keyboard-related events are directed to the focus item, if
674any (see the \fBfocus\fR widget command below for more on this). If a
675virtual event is used in a binding, that binding can trigger only if the
676virtual event is defined by an underlying mouse-related or
677keyboard-related event.
678.PP
679It is possible for multiple bindings to match a particular event.
680This could occur, for example, if one binding is associated with the
681item's id and another is associated with one of the item's tags.
682When this occurs, all of the matching bindings are invoked.
683A binding associated with the \fBall\fR tag is invoked first,
684followed by one binding for each of the item's tags (in order),
685followed by a binding associated with the item's id.
686If there are multiple matching bindings for a single tag,
687then only the most specific binding is invoked.
688A \fBcontinue\fR command in a binding script terminates that
689script, and a \fBbreak\fR command terminates that script
690and skips any remaining scripts for the event, just as for the
691\fBbind\fR command.
692.PP
693If bindings have been created for a canvas window using the \fBbind\fR
694command, then they are invoked in addition to bindings created for
695the canvas's items using the \fBbind\fR widget command.
696The bindings for items will be invoked before any of the bindings
697for the window as a whole.
698.RE
699.TP
700\fIpathName \fBcanvasx \fIscreenx\fR ?\fIgridspacing\fR?
701Given a window x-coordinate in the canvas \fIscreenx\fR, this command returns
702the canvas x-coordinate that is displayed at that location.
703If \fIgridspacing\fR is specified, then the canvas coordinate is
704rounded to the nearest multiple of \fIgridspacing\fR units.
705.TP
706\fIpathName \fBcanvasy \fIscreeny\fR ?\fIgridspacing\fR?
707Given a window y-coordinate in the canvas \fIscreeny\fR this command returns
708the canvas y-coordinate that is displayed at that location.
709If \fIgridspacing\fR is specified, then the canvas coordinate is
710rounded to the nearest multiple of \fIgridspacing\fR units.
711.TP
712\fIpathName \fBcget\fR \fIoption\fR
713Returns the current value of the configuration option given
714by \fIoption\fR.
715\fIOption\fR may have any of the values accepted by the \fBcanvas\fR
716command.
717.TP
718\fIpathName \fBconfigure ?\fIoption\fR? ?\fIvalue\fR? ?\fIoption value ...\fR?
719Query or modify the configuration options of the widget.
720If no \fIoption\fR is specified, returns a list describing all of
721the available options for \fIpathName\fR (see \fBTk_ConfigureInfo\fR for
722information on the format of this list). If \fIoption\fR is specified
723with no \fIvalue\fR, then the command returns a list describing the
724one named option (this list will be identical to the corresponding
725sublist of the value returned if no \fIoption\fR is specified). If
726one or more \fIoption\-value\fR pairs are specified, then the command
727modifies the given widget option(s) to have the given value(s); in
728this case the command returns an empty string.
729\fIOption\fR may have any of the values accepted by the \fBcanvas\fR
730command.
731.TP
732\fIpathName\fR \fBcoords \fItagOrId \fR?\fIx0 y0 ...\fR?
733.TP
734\fIpathName\fR \fBcoords \fItagOrId \fR?\fIcoordList\fR?
735Query or modify the coordinates that define an item.
736If no coordinates are specified, this command returns a list
737whose elements are the coordinates of the item named by
738\fItagOrId\fR.
739If coordinates are specified, then they replace the current
740coordinates for the named item.
741If \fItagOrId\fR refers to multiple items, then
742the first one in the display list is used.
743.TP
744\fIpathName \fBcreate \fItype x y \fR?\fIx y ...\fR? ?\fIoption value ...\fR?
745.TP
746\fIpathName \fBcreate \fItype coordList \fR?\fIoption value ...\fR?
747Create a new item in \fIpathName\fR of type \fItype\fR.
748The exact format of the arguments after \fBtype\fR depends
749on \fBtype\fR, but usually they consist of the coordinates for
750one or more points, followed by specifications for zero or
751more item options.
752See the subsections on individual item types below for more
753on the syntax of this command.
754This command returns the id for the new item.
755.TP
756\fIpathName \fBdchars \fItagOrId first \fR?\fIlast\fR?
757For each item given by \fItagOrId\fR, delete the characters, or coordinates,
758in the range given by \fIfirst\fR and \fIlast\fR, inclusive.
759If some of the items given by \fItagOrId\fR don't support
760indexing operations then they ignore dchars.
761Text items interpret \fIfirst\fR and \fIlast\fR as indices to a character,
762line and polygon items interpret them indices to a coordinate (an x,y pair).
763Indices are described in INDICES above.
764If \fIlast\fR is omitted, it defaults to \fIfirst\fR.
765This command returns an empty string.
766.TP
767\fIpathName \fBdelete \fR?\fItagOrId tagOrId ...\fR?
768Delete each of the items given by each \fItagOrId\fR, and return
769an empty string.
770.TP
771\fIpathName \fBdtag \fItagOrId \fR?\fItagToDelete\fR?
772For each of the items given by \fItagOrId\fR, delete the
773tag given by \fItagToDelete\fR from the list of those
774associated with the item.
775If an item doesn't have the tag \fItagToDelete\fR then
776the item is unaffected by the command.
777If \fItagToDelete\fR is omitted then it defaults to \fItagOrId\fR.
778This command returns an empty string.
779.TP
780\fIpathName \fBfind \fIsearchCommand \fR?\fIarg arg ...\fR?
781This command returns a list consisting of all the items that
782meet the constraints specified by \fIsearchCommand\fR and
783\fIarg\fR's.
784\fISearchCommand\fR and \fIargs\fR have any of the forms
785accepted by the \fBaddtag\fR command.
786The items are returned in stacking order, with the lowest item first.
787.TP
788\fIpathName \fBfocus \fR?\fItagOrId\fR?
789Set the keyboard focus for the canvas widget to the item given by
790\fItagOrId\fR.
791If \fItagOrId\fR refers to several items, then the focus is set
792to the first such item in the display list that supports the
793insertion cursor.
794If \fItagOrId\fR doesn't refer to any items, or if none of them
795support the insertion cursor, then the focus isn't changed.
796If \fItagOrId\fR is an empty
797string, then the focus item is reset so that no item has the focus.
798If \fItagOrId\fR is not specified then the command returns the
799id for the item that currently has the focus, or an empty string
800if no item has the focus.
801.RS
802.PP
803Once the focus has been set to an item, the item will display
804the insertion cursor and all keyboard events will be directed
805to that item.
806The focus item within a canvas and the focus window on the
807screen (set with the \fBfocus\fR command) are totally independent:
808a given item doesn't actually have the input focus unless (a)
809its canvas is the focus window and (b) the item is the focus item
810within the canvas.
811In most cases it is advisable to follow the \fBfocus\fR widget
812command with the \fBfocus\fR command to set the focus window to
813the canvas (if it wasn't there already).
814.RE
815.TP
816\fIpathName \fBgettags\fR \fItagOrId\fR
817Return a list whose elements are the tags associated with the
818item given by \fItagOrId\fR.
819If \fItagOrId\fR refers to more than one item, then the tags
820are returned from the first such item in the display list.
821If \fItagOrId\fR doesn't refer to any items, or if the item
822contains no tags, then an empty string is returned.
823.TP
824\fIpathName \fBicursor \fItagOrId index\fR
825Set the position of the insertion cursor for the item(s) given by \fItagOrId\fR
826to just before the character whose position is given by \fIindex\fR.
827If some or all of the items given by \fItagOrId\fR don't support
828an insertion cursor then this command has no effect on them.
829See INDICES above for a description of the
830legal forms for \fIindex\fR.
831Note: the insertion cursor is only displayed in an item if
832that item currently has the keyboard focus (see the widget
833command \fBfocus\fR, below), but the cursor position may
834be set even when the item doesn't have the focus.
835This command returns an empty string.
836.TP
837\fIpathName \fBindex \fItagOrId index\fR
838This command returns a decimal string giving the numerical index
839within \fItagOrId\fR corresponding to \fIindex\fR.
840\fIIndex\fR gives a textual description of the desired position
841as described in INDICES above.
842Text items interpret \fIindex\fR as an index to a character,
843line and polygon items interpret it as an index to a coordinate (an x,y pair).
844The return value is guaranteed to lie between 0 and the number
845of characters, or coordinates, within the item, inclusive.
846If \fItagOrId\fR refers to multiple items, then the index
847is processed in the first of these items that supports indexing
848operations (in display list order).
849.TP
850\fIpathName \fBinsert \fItagOrId beforeThis string\fR
851For each of the items given by \fItagOrId\fR, if the item supports
852text or coordinate, insertion then \fIstring\fR is inserted into the item's
853text just before the character, or coordinate, whose index is \fIbeforeThis\fR.
854Text items interpret \fIbeforeThis\fR as an index to a character,
855line and polygon items interpret it as an index to a coordinate (an x,y pair).
856For lines and polygons the \fIstring\fR must be a valid coordinate
857sequence.
858See INDICES above for information about the forms allowed
859for \fIbeforeThis\fR.
860This command returns an empty string.
861.TP
862\fIpathName \fBitemcget\fR \fItagOrId\fR \fIoption\fR
863Returns the current value of the configuration option for the
864item given by \fItagOrId\fR whose name is \fIoption\fR.
865This command is similar to the \fBcget\fR widget command except that
866it applies to a particular item rather than the widget as a whole.
867\fIOption\fR may have any of the values accepted by the \fBcreate\fR
868widget command when the item was created.
869If \fItagOrId\fR is a tag that refers to more than one item,
870the first (lowest) such item is used.
871.TP
872\fIpathName \fBitemconfigure \fItagOrId\fR ?\fIoption\fR? ?\fIvalue\fR? ?\fIoption value ...\fR?
873This command is similar to the \fBconfigure\fR widget command except
874that it modifies item-specific options for the items given by
875\fItagOrId\fR instead of modifying options for the overall
876canvas widget.
877If no \fIoption\fR is specified, returns a list describing all of
878the available options for the first item given by \fItagOrId\fR
879(see \fBTk_ConfigureInfo\fR for
880information on the format of this list). If \fIoption\fR is specified
881with no \fIvalue\fR, then the command returns a list describing the
882one named option (this list will be identical to the corresponding
883sublist of the value returned if no \fIoption\fR is specified). If
884one or more \fIoption\-value\fR pairs are specified, then the command
885modifies the given widget option(s) to have the given value(s) in
886each of the items given by \fItagOrId\fR; in
887this case the command returns an empty string.
888The \fIoption\fRs and \fIvalue\fRs are the same as those permissible
889in the \fBcreate\fR widget command when the item(s) were created;
890see the sections describing individual item types below for details
891on the legal options.
892.TP
893\fIpathName \fBlower \fItagOrId \fR?\fIbelowThis\fR?
894Move all of the items given by \fItagOrId\fR to a new position
895in the display list just before the item given by \fIbelowThis\fR.
896If \fItagOrId\fR refers to more than one item then all are moved
897but the relative order of the moved items will not be changed.
898\fIBelowThis\fR is a tag or id; if it refers to more than one
899item then the first (lowest) of these items in the display list is used
900as the destination location for the moved items.
901Note: this command has no effect on window items. Window items always
902obscure other item types, and the stacking order of window items is
903determined by the \fBraise\fR and \fBlower\fR commands, not the
904\fBraise\fR and \fBlower\fR widget commands for canvases.
905This command returns an empty string.
906.TP
907\fIpathName \fBmove \fItagOrId xAmount yAmount\fR
908Move each of the items given by \fItagOrId\fR in the canvas coordinate
909space by adding \fIxAmount\fR to the x-coordinate of each point
910associated with the item and \fIyAmount\fR to the y-coordinate of
911each point associated with the item.
912This command returns an empty string.
913.TP
914\fIpathName \fBpostscript \fR?\fIoption value option value ...\fR?
915Generate a Postscript representation for part or all of the canvas.
916If the \fB\-file\fR option is specified then the Postscript is written
917to a file and an empty string is returned; otherwise the Postscript
918is returned as the result of the command.
919If the interpreter that owns the canvas is marked as safe, the operation
920will fail because safe interpreters are not allowed to write files.
921If the \fB\-channel\fR option is specified, the argument denotes the name
922of a channel already opened for writing. The Postscript is written to
923that channel, and the channel is left open for further writing at the end
924of the operation.
925The Postscript is created in Encapsulated Postscript form using
926version 3.0 of the Document Structuring Conventions.
927Note: by default Postscript is only generated for information that
928appears in the canvas's window on the screen. If the canvas is
929freshly created it may still have its initial size of 1x1 pixel
930so nothing will appear in the Postscript. To get around this problem
931either invoke the "update" command to wait for the canvas window
932to reach its final size, or else use the \fB\-width\fR and \fB\-height\fR
933options to specify the area of the canvas to print.
934The \fIoption\fR\-\fIvalue\fR argument pairs provide additional
935information to control the generation of Postscript. The following
936options are supported:
937.RS
938.TP
939\fB\-colormap \fIvarName\fR
940\fIVarName\fR must be the name of an array variable
941that specifies a color mapping to use in the Postscript.
942Each element of \fIvarName\fR must consist of Postscript
943code to set a particular color value (e.g. ``\fB1.0 1.0 0.0 setrgbcolor\fR'').
944When outputting color information in the Postscript, Tk checks
945to see if there is an element of \fIvarName\fR with the same
946name as the color.
947If so, Tk uses the value of the element as the Postscript command
948to set the color.
949If this option hasn't been specified, or if there isn't an entry
950in \fIvarName\fR for a given color, then Tk uses the red, green,
951and blue intensities from the X color.
952.TP
953\fB\-colormode \fImode\fR
954Specifies how to output color information. \fIMode\fR must be either
955\fBcolor\fR (for full color output), \fBgray\fR (convert all colors
956to their gray-scale equivalents) or \fBmono\fR (convert all colors
957to black or white).
958.TP
959\fB\-file \fIfileName\fR
960Specifies the name of the file in which to write the Postscript.
961If this option isn't specified then the Postscript is returned as the
962result of the command instead of being written to a file.
963.TP
964\fB\-fontmap \fIvarName\fR
965\fIVarName\fR must be the name of an array variable
966that specifies a font mapping to use in the Postscript.
967Each element of \fIvarName\fR must consist of a Tcl list with
968two elements, which are the name and point size of a Postscript font.
969When outputting Postscript commands for a particular font, Tk
970checks to see if \fIvarName\fR contains an element with the same
971name as the font.
972If there is such an element, then the font information contained in
973that element is used in the Postscript.
974Otherwise Tk attempts to guess what Postscript font to use.
975Tk's guesses generally only work for well-known fonts such as
976Times and Helvetica and Courier, and only if the X font name does not
977omit any dashes up through the point size.
978For example, \fB\-*\-Courier\-Bold\-R\-Normal\-\-*\-120\-*\fR will work but
979\fB*Courier\-Bold\-R\-Normal*120*\fR will not; Tk needs the dashes to
980parse the font name).
981.TP
982\fB\-height \fIsize\fR
983Specifies the height of the area of the canvas to print.
984Defaults to the height of the canvas window.
985.TP
986\fB\-pageanchor \fIanchor\fR
987Specifies which point of the printed area of the canvas should appear over
988the positioning point on the page (which is given by the \fB\-pagex\fR
989and \fB\-pagey\fR options).
990For example, \fB\-pageanchor n\fR means that the top center of the
991area of the canvas being printed (as it appears in the canvas window)
992should be over the positioning point. Defaults to \fBcenter\fR.
993.TP
994\fB\-pageheight \fIsize\fR
995Specifies that the Postscript should be scaled in both x and y so
996that the printed area is \fIsize\fR high on the Postscript page.
997\fISize\fR consists of a floating-point number followed by
998\fBc\fR for centimeters, \fBi\fR for inches, \fBm\fR for millimeters,
999or \fBp\fR or nothing for printer's points (1/72 inch).
1000Defaults to the height of the printed area on the screen.
1001If both \fB\-pageheight\fR and \fB\-pagewidth\fR are specified then
1002the scale factor from \fB\-pagewidth\fR is used (non-uniform scaling
1003is not implemented).
1004.TP
1005\fB\-pagewidth \fIsize\fR
1006Specifies that the Postscript should be scaled in both x and y so
1007that the printed area is \fIsize\fR wide on the Postscript page.
1008\fISize\fR has the same form as for \fB\-pageheight\fR.
1009Defaults to the width of the printed area on the screen.
1010If both \fB\-pageheight\fR and \fB\-pagewidth\fR are specified then
1011the scale factor from \fB\-pagewidth\fR is used (non-uniform scaling
1012is not implemented).
1013.TP
1014\fB\-pagex \fIposition\fR
1015\fIPosition\fR gives the x-coordinate of the positioning point on
1016the Postscript page, using any of the forms allowed for \fB\-pageheight\fR.
1017Used in conjunction with the \fB\-pagey\fR and \fB\-pageanchor\fR options
1018to determine where the printed area appears on the Postscript page.
1019Defaults to the center of the page.
1020.TP
1021\fB\-pagey \fIposition\fR
1022\fIPosition\fR gives the y-coordinate of the positioning point on
1023the Postscript page, using any of the forms allowed for \fB\-pageheight\fR.
1024Used in conjunction with the \fB\-pagex\fR and \fB\-pageanchor\fR options
1025to determine where the printed area appears on the Postscript page.
1026Defaults to the center of the page.
1027.TP
1028\fB\-rotate \fIboolean\fR
1029\fIBoolean\fR specifies whether the printed area is to be rotated 90
1030degrees.
1031In non-rotated output the x-axis of the printed area runs along
1032the short dimension of the page (``portrait'' orientation);
1033in rotated output the x-axis runs along the long dimension of the
1034page (``landscape'' orientation).
1035Defaults to non-rotated.
1036.TP
1037\fB\-width \fIsize\fR
1038Specifies the width of the area of the canvas to print.
1039Defaults to the width of the canvas window.
1040.TP
1041\fB\-x \fIposition\fR
1042Specifies the x-coordinate of the left edge of the area of the
1043canvas that is to be printed, in canvas coordinates, not window
1044coordinates.
1045Defaults to the coordinate of the left edge of the window.
1046.TP
1047\fB\-y \fIposition\fR
1048Specifies the y-coordinate of the top edge of the area of the
1049canvas that is to be printed, in canvas coordinates, not window
1050coordinates.
1051Defaults to the coordinate of the top edge of the window.
1052.RE
1053.TP
1054\fIpathName \fBraise \fItagOrId \fR?\fIaboveThis\fR?
1055Move all of the items given by \fItagOrId\fR to a new position
1056in the display list just after the item given by \fIaboveThis\fR.
1057If \fItagOrId\fR refers to more than one item then all are moved
1058but the relative order of the moved items will not be changed.
1059\fIAboveThis\fR is a tag or id; if it refers to more than one
1060item then the last (topmost) of these items in the display list is used
1061as the destination location for the moved items.
1062Note: this command has no effect on window items. Window items always
1063obscure other item types, and the stacking order of window items is
1064determined by the \fBraise\fR and \fBlower\fR commands, not the
1065\fBraise\fR and \fBlower\fR widget commands for canvases.
1066This command returns an empty string.
1067.TP
1068\fIpathName \fBscale \fItagOrId xOrigin yOrigin xScale yScale\fR
1069Rescale all of the items given by \fItagOrId\fR in canvas coordinate
1070space.
1071\fIXOrigin\fR and \fIyOrigin\fR identify the origin for the scaling
1072operation and \fIxScale\fR and \fIyScale\fR identify the scale
1073factors for x- and y-coordinates, respectively (a scale factor of
10741.0 implies no change to that coordinate).
1075For each of the points defining each item, the x-coordinate is
1076adjusted to change the distance from \fIxOrigin\fR by a factor
1077of \fIxScale\fR.
1078Similarly, each y-coordinate is adjusted to change the distance
1079from \fIyOrigin\fR by a factor of \fIyScale\fR.
1080This command returns an empty string.
1081.TP
1082\fIpathName \fBscan\fR \fIoption args\fR
1083This command is used to implement scanning on canvases. It has
1084two forms, depending on \fIoption\fR:
1085.RS
1086.TP
1087\fIpathName \fBscan mark \fIx y\fR
1088Records \fIx\fR and \fIy\fR and the canvas's current view; used
1089in conjunction with later \fBscan dragto\fR commands.
1090Typically this command is associated with a mouse button press in
1091the widget and \fIx\fR and \fIy\fR are the coordinates of the
1092mouse. It returns an empty string.
1093.TP
1094\fIpathName \fBscan dragto \fIx y ?gain?\fR.
1095This command computes the difference between its \fIx\fR and \fIy\fR
1096arguments (which are typically mouse coordinates) and the \fIx\fR and
1097\fIy\fR arguments to the last \fBscan mark\fR command for the widget.
1098It then adjusts the view by \fIgain\fR times the
1099difference in coordinates, where \fIgain\fR defaults to 10.
1100This command is typically associated
1101with mouse motion events in the widget, to produce the effect of
1102dragging the canvas at high speed through its window. The return
1103value is an empty string.
1104.RE
1105.TP
1106\fIpathName \fBselect \fIoption\fR ?\fItagOrId arg\fR?
1107Manipulates the selection in one of several ways, depending on
1108\fIoption\fR.
1109The command may take any of the forms described below.
1110In all of the descriptions below, \fItagOrId\fR must refer to
1111an item that supports indexing and selection; if it refers to
1112multiple items then the first of
1113these that supports indexing and the selection is used.
1114\fIIndex\fR gives a textual description of a position
1115within \fItagOrId\fR, as described in INDICES above.
1116.RS
1117.TP
1118\fIpathName \fBselect adjust \fItagOrId index\fR
1119Locate the end of the selection in \fItagOrId\fR nearest
1120to the character given by \fIindex\fR, and adjust that
1121end of the selection to be at \fIindex\fR (i.e. including
1122but not going beyond \fIindex\fR).
1123The other end of the selection is made the anchor point
1124for future \fBselect to\fR commands.
1125If the selection isn't currently in \fItagOrId\fR then
1126this command behaves the same as the \fBselect to\fR widget
1127command.
1128Returns an empty string.
1129.TP
1130\fIpathName \fBselect clear\fR
1131Clear the selection if it is in this widget.
1132If the selection isn't in this widget then the command
1133has no effect.
1134Returns an empty string.
1135.TP
1136\fIpathName \fBselect from \fItagOrId index\fR
1137Set the selection anchor point for the widget to be just
1138before the character
1139given by \fIindex\fR in the item given by \fItagOrId\fR.
1140This command doesn't change the selection; it just sets
1141the fixed end of the selection for future \fBselect to\fR
1142commands.
1143Returns an empty string.
1144.TP
1145\fIpathName \fBselect item\fR
1146Returns the id of the selected item, if the selection is in an
1147item in this canvas.
1148If the selection is not in this canvas then an empty string
1149is returned.
1150.TP
1151\fIpathName \fBselect to \fItagOrId index\fR
1152Set the selection to consist of those characters of \fItagOrId\fR
1153between the selection anchor point and
1154\fIindex\fR.
1155The new selection will include the character given by \fIindex\fR;
1156it will include the character given by the anchor point only if
1157\fIindex\fR is greater than or equal to the anchor point.
1158The anchor point is determined by the most recent \fBselect adjust\fR
1159or \fBselect from\fR command for this widget.
1160If the selection anchor point for the widget isn't currently in
1161\fItagOrId\fR, then it is set to the same character given
1162by \fIindex\fR.
1163Returns an empty string.
1164.RE
1165.TP
1166\fIpathName \fBtype\fI tagOrId\fR
1167Returns the type of the item given by \fItagOrId\fR, such as
1168\fBrectangle\fR or \fBtext\fR.
1169If \fItagOrId\fR refers to more than one item, then the type
1170of the first item in the display list is returned.
1171If \fItagOrId\fR doesn't refer to any items at all then
1172an empty string is returned.
1173.TP
1174\fIpathName \fBxview \fR?\fIargs\fR?
1175This command is used to query and change the horizontal position of the
1176information displayed in the canvas's window.
1177It can take any of the following forms:
1178.RS
1179.TP
1180\fIpathName \fBxview\fR
1181Returns a list containing two elements.
1182Each element is a real fraction between 0 and 1; together they describe
1183the horizontal span that is visible in the window.
1184For example, if the first element is .2 and the second element is .6,
118520% of the canvas's area (as defined by the \fB\-scrollregion\fR option)
1186is off-screen to the left, the middle 40% is visible
1187in the window, and 40% of the canvas is off-screen to the right.
1188These are the same values passed to scrollbars via the \fB\-xscrollcommand\fR
1189option.
1190.TP
1191\fIpathName \fBxview moveto\fI fraction\fR
1192Adjusts the view in the window so that \fIfraction\fR of the
1193total width of the canvas is off-screen to the left.
1194\fIFraction\fR must be a fraction between 0 and 1.
1195.TP
1196\fIpathName \fBxview scroll \fInumber what\fR
1197This command shifts the view in the window left or right according to
1198\fInumber\fR and \fIwhat\fR.
1199\fINumber\fR must be an integer.
1200\fIWhat\fR must be either \fBunits\fR or \fBpages\fR or an abbreviation
1201of one of these.
1202If \fIwhat\fR is \fBunits\fR, the view adjusts left or right in units
1203of the \fBxScrollIncrement\fR option, if it is greater than zero,
1204or in units of one-tenth the window's width otherwise.
1205If \fIwhat is \fBpages\fR then the view
1206adjusts in units of nine-tenths the window's width.
1207If \fInumber\fR is negative then information farther to the left
1208becomes visible; if it is positive then information farther to the right
1209becomes visible.
1210.RE
1211.TP
1212\fIpathName \fByview \fI?args\fR?
1213This command is used to query and change the vertical position of the
1214information displayed in the canvas's window.
1215It can take any of the following forms:
1216.RS
1217.TP
1218\fIpathName \fByview\fR
1219Returns a list containing two elements.
1220Each element is a real fraction between 0 and 1; together they describe
1221the vertical span that is visible in the window.
1222For example, if the first element is .6 and the second element is 1.0,
1223the lowest 40% of the canvas's area (as defined by the \fB\-scrollregion\fR
1224option) is visible in the window.
1225These are the same values passed to scrollbars via the \fB\-yscrollcommand\fR
1226option.
1227.TP
1228\fIpathName \fByview moveto\fI fraction\fR
1229Adjusts the view in the window so that \fIfraction\fR of the canvas's
1230area is off-screen to the top.
1231\fIFraction\fR is a fraction between 0 and 1.
1232.TP
1233\fIpathName \fByview scroll \fInumber what\fR
1234This command adjusts the view in the window up or down according to
1235\fInumber\fR and \fIwhat\fR.
1236\fINumber\fR must be an integer.
1237\fIWhat\fR must be either \fBunits\fR or \fBpages\fR.
1238If \fIwhat\fR is \fBunits\fR, the view adjusts up or down in units
1239of the \fByScrollIncrement\fR option, if it is greater than zero,
1240or in units of one-tenth the window's height otherwise.
1241If \fIwhat\fR is \fBpages\fR then
1242the view adjusts in units of nine-tenths the window's height.
1243If \fInumber\fR is negative then higher information becomes
1244visible; if it is positive then lower information
1245becomes visible.
1246.RE
1247.SH "OVERVIEW OF ITEM TYPES"
1248.PP
1249The sections below describe the various types of items supported
1250by canvas widgets. Each item type is characterized by two things:
1251first, the form of the \fBcreate\fR command used to create
1252instances of the type; and second, a set of configuration options
1253for items of that type, which may be used in the
1254\fBcreate\fR and \fBitemconfigure\fR widget commands.
1255Most items don't support indexing or selection or the commands
1256related to them, such as \fBindex\fR and \fBinsert\fR.
1257Where items do support these facilities, it is noted explicitly
1258in the descriptions below.
1259At present, text, line and polygon items provide this support.
1260For lines and polygons the indexing facility is used to manipulate
1261the coordinates of the item.
1262.SH "COMMON ITEM OPTIONS"
1263.PP
1264Many items share a common set of options. These options are
1265explained here, and then referred to be each widget type for brevity.
1266.PP
1267.TP
1268\fB\-dash \fIpattern\fR
1269.TP
1270\fB\-activedash \fIpattern\fR
1271.TP
1272\fB\-disableddash \fIpattern\fR
1273This option specifies dash patterns for the normal, active
1274state, and disabled state of an item.
1275\fIpattern\fR may have any of the forms accepted by \fBTk_GetDash\fR.
1276If the dash options are omitted then the default is a solid outline.
1277See "DASH PATTERNS" for more information.
1278.TP
1279\fB\-dashoffset \fIoffset\fR
1280The starting \fIoffset\fR in pixels into the pattern provided by the
1281\fB\-dash\fR option. \fB\-dashoffset\fR is ignored if there is no
1282\fB-dash\fR pattern. The \fIoffset\fR may have any of the forms described
1283in the \fBCOORDINATES\fR section above.
1284.TP
1285\fB\-fill \fIcolor\fR
1286.TP
1287\fB\-activefill \fIcolor\fR
1288.TP
1289\fB\-disabledfill \fIcolor\fR
1290Specifies the color to be used to fill item's area.
1291in its normal, active, and disabled states,
1292\fIColor\fR may have any of the forms accepted by \fBTk_GetColor\fR.
1293If \fIcolor\fR is an empty string (the default),
1294then the item will not be filled.
1295For the line item, it specifies the color of the line drawn.
1296For the text item, it specifies the foreground color of the text.
1297.TP
1298\fB\-outline \fIcolor\fR
1299.TP
1300\fB\-activeoutline \fIcolor\fR
1301.TP
1302\fB\-disabledoutline \fIcolor\fR
1303This option specifies the color that should be used to draw the
1304outline of the item in its normal, active and disabled states.
1305\fIColor\fR may have any of the forms accepted by \fBTk_GetColor\fR.
1306This option defaults to \fBblack\fR. If \fIcolor\fR is specified
1307as an empty string then no outline is drawn for the item.
1308.TP
1309\fB\-offset \fIoffset\fR
1310Specifies the offset of stipples. The offset value can be of the form
1311\fBx,y\fR or \fBside\fR, where side can be \fBn\fR, \fBne\fR, \fBe\fR,
1312\fBse\fR, \fBs\fR, \fBsw\fR, \fBw\fR, \fBnw\fR, or \fBcenter\fR. In the
1313first case the origin is the origin of the toplevel of the current window.
1314For the canvas itself and canvas objects the origin is the canvas origin,
1315but putting \fB#\fR in front of the coordinate pair indicates using the
1316toplevel origin instead. For canvas objects, the \fB-offset\fR option is
1317used for stippling as well. For the line and polygon canvas items you can
1318also specify an index as argument, which connects the stipple origin to one
1319of the coordinate points of the line/polygon.
1320.TP
1321\fB\-outlinestipple \fIbitmap\fR
1322.TP
1323\fB\-activeoutlinestipple \fIbitmap\fR
1324.TP
1325\fB\-disabledoutlinestipple \fIbitmap\fR
1326This option specifies stipple patterns that should be used to draw the
1327outline of the item in its normal, active and disabled states.
1328Indicates that the outline for the item should be drawn with a stipple pattern;
1329\fIbitmap\fR specifies the stipple pattern to use, in any of the
1330forms accepted by \fBTk_GetBitmap\fR.
1331If the \fB\-outline\fR option hasn't been specified then this option
1332has no effect.
1333If \fIbitmap\fR is an empty string (the default), then the outline is drawn
1334in a solid fashion.
1335.TP
1336\fB\-stipple \fIbitmap\fR
1337.TP
1338\fB\-activestipple \fIbitmap\fR
1339.TP
1340\fB\-disabledstipple \fIbitmap\fR
1341This option specifies stipple patterns that should be used to fill
1342the item in its normal, active and disabled states.
1343\fIbitmap\fR specifies the stipple pattern to use, in any of the
1344forms accepted by \fBTk_GetBitmap\fR.
1345If the \fB\-fill\fR option hasn't been specified then this option
1346has no effect.
1347If \fIbitmap\fR is an empty string (the default), then filling is done
1348in a solid fashion.
1349For the text item, it affects the actual text.
1350.TP
1351\fB\-state \fIstate\fR
1352This allows an item to override the canvas widget's global \fIstate\fR
1353option. It takes the same values:
1354\fInormal\fR, \fIdisabled\fR or \fIhidden\fR.
1355.TP
1356\fB\-tags \fItagList\fR
1357Specifies a set of tags to apply to the item.
1358\fITagList\fR consists of a list of tag names, which replace any
1359existing tags for the item. \fITagList\fR may be an empty list.
1360.TP
1361\fB\-width \fIoutlineWidth\fR
1362.TP
1363\fB\-activewidth \fIoutlineWidth\fR
1364.TP
1365\fB\-disabledwidth \fIoutlineWidth\fR
1366Specifies the width of the outline to be drawn around
1367the item's region, in its normal, active and disabled states.
1368\fIoutlineWidth\fR may be in any of the forms described in the
1369\fBCOORDINATES\fR section above.
1370If the \fB\-outline\fR option has been specified as an empty string then
1371this option has no effect. This option defaults to 1.0.
1372For arcs, wide outlines will be drawn centered on the edges of the
1373arc's region.
1374.SH "ARC ITEMS"
1375.PP
1376Items of type \fBarc\fR appear on the display as arc-shaped regions.
1377An arc is a section of an oval delimited by two angles (specified
1378by the \fB\-start\fR and \fB\-extent\fR options) and displayed in
1379one of several ways (specified by the \fB\-style\fR option).
1380Arcs are created with widget commands of the following form:
1381.CS
1382\fIpathName \fBcreate arc \fIx1 y1 x2 y2 \fR?\fIoption value option value ...\fR?
1383\fIpathName \fBcreate arc \fIcoordList\fR ?\fIoption value option value ...\fR?
1384.CE
1385The arguments \fIx1\fR, \fIy1\fR, \fIx2\fR, and \fIy2\fR or \fIcoordList\fR give
1386the coordinates of two diagonally opposite corners of a
1387rectangular region enclosing the oval that defines the arc.
1388After the coordinates there may be any number of \fIoption\fR\-\fIvalue\fR
1389pairs, each of which sets one of the configuration options
1390for the item. These same \fIoption\fR\-\fIvalue\fR pairs may be
1391used in \fBitemconfigure\fR widget commands to change the item's
1392configuration.
1393.br
1394The following standard options are supported by arcs:
1395.CS
1396\-dash
1397\-activedash
1398\-disableddash
1399\-dashoffset
1400\-fill
1401\-activefill
1402\-disabledfill
1403\-offset
1404\-outline
1405\-activeoutline
1406\-disabledoutline
1407\-outlinestipple
1408\-activeoutlinestipple
1409\-disabledoutlinestipple
1410\-stipple
1411\-activestipple
1412\-disabledstipple
1413\-state
1414\-tags
1415\-width
1416\-activewidth
1417\-disabledwidth
1418.CE
1419The following extra options are supported for arcs:
1420.TP
1421\fB\-extent \fIdegrees\fR
1422Specifies the size of the angular range occupied by the arc.
1423The arc's range extends for \fIdegrees\fR degrees counter-clockwise
1424from the starting angle given by the \fB\-start\fR option.
1425\fIDegrees\fR may be negative.
1426If it is greater than 360 or less than -360, then \fIdegrees\fR
1427modulo 360 is used as the extent.
1428.TP
1429\fB\-start \fIdegrees\fR
1430Specifies the beginning of the angular range occupied by the
1431arc.
1432\fIDegrees\fR is given in units of degrees measured counter-clockwise
1433from the 3-o'clock position; it may be either positive or negative.
1434.TP
1435\fB\-style \fItype\fR
1436Specifies how to draw the arc. If \fItype\fR is \fBpieslice\fR
1437(the default) then the arc's region is defined by a section
1438of the oval's perimeter plus two line segments, one between the center
1439of the oval and each end of the perimeter section.
1440If \fItype\fR is \fBchord\fR then the arc's region is defined
1441by a section of the oval's perimeter plus a single line segment
1442connecting the two end points of the perimeter section.
1443If \fItype\fR is \fBarc\fR then the arc's region consists of
1444a section of the perimeter alone.
1445In this last case the \fB\-fill\fR option is ignored.
1446.SH "BITMAP ITEMS"
1447.PP
1448Items of type \fBbitmap\fR appear on the display as images with
1449two colors, foreground and background.
1450Bitmaps are created with widget commands of the following form:
1451.CS
1452\fIpathName \fBcreate bitmap \fIx y \fR?\fIoption value option value ...\fR?
1453\fIpathName \fBcreate bitmap \fIcoordList\fR ?\fIoption value option value ...\fR?
1454.CE
1455The arguments \fIx\fR and \fIy\fR or \fIcoordList\fR specify the coordinates of a
1456point used to position the bitmap on the display (see the \fB\-anchor\fR
1457option below for more information on how bitmaps are displayed).
1458After the coordinates there may be any number of \fIoption\fR\-\fIvalue\fR
1459pairs, each of which sets one of the configuration options
1460for the item. These same \fIoption\fR\-\fIvalue\fR pairs may be
1461used in \fBitemconfigure\fR widget commands to change the item's
1462configuration.
1463.br
1464The following standard options are supported by bitmaps:
1465.CS
1466\-state
1467\-tags
1468.CE
1469The following extra options are supported for bitmaps:
1470.TP
1471\fB\-anchor \fIanchorPos\fR
1472\fIAnchorPos\fR tells how to position the bitmap relative to the
1473positioning point for the item; it may have any of the forms
1474accepted by \fBTk_GetAnchor\fR. For example, if \fIanchorPos\fR
1475is \fBcenter\fR then the bitmap is centered on the point; if
1476\fIanchorPos\fR is \fBn\fR then the bitmap will be drawn so that
1477its top center point is at the positioning point.
1478This option defaults to \fBcenter\fR.
1479.TP
1480\fB\-background \fIcolor\fR
1481.TP
1482\fB\-activebackground \fIbitmap\fR
1483.TP
1484\fB\-disabledbackground \fIbitmap\fR
1485Specifies the color to use for each of the bitmap's '0' valued pixels
1486in its normal, active and disabled states.
1487\fIColor\fR may have any of the forms accepted by \fBTk_GetColor\fR.
1488If this option isn't specified, or if it is specified as an empty
1489string, then nothing is displayed where the bitmap pixels are 0; this
1490produces a transparent effect.
1491.TP
1492\fB\-bitmap \fIbitmap\fR
1493.TP
1494\fB\-activebitmap \fIbitmap\fR
1495.TP
1496\fB\-disabledbitmap \fIbitmap\fR
1497Specifies the bitmaps to display in the item in its normal, active and
1498disabled states.
1499\fIBitmap\fR may have any of the forms accepted by \fBTk_GetBitmap\fR.
1500.TP
1501\fB\-foreground \fIcolor\fR
1502.TP
1503\fB\-activeforeground \fIbitmap\fR
1504.TP
1505\fB\-disabledforeground \fIbitmap\fR
1506Specifies the color to use for each of the bitmap's '1' valued pixels
1507in its normal, active and disabled states.
1508\fIColor\fR may have any of the forms accepted by \fBTk_GetColor\fR and
1509defaults to \fBblack\fR.
1510.SH "IMAGE ITEMS"
1511.PP
1512Items of type \fBimage\fR are used to display images on a
1513canvas.
1514Images are created with widget commands of the following form:
1515.CS
1516\fIpathName \fBcreate image \fIx y \fR?\fIoption value option value ...\fR?
1517\fIpathName \fBcreate image \fIcoordList\fR ?\fIoption value option value ...\fR?
1518.CE
1519The arguments \fIx\fR and \fIy\fR or \fIcoordList\fR specify the coordinates of a
1520point used to position the image on the display (see the \fB\-anchor\fR
1521option below for more information).
1522After the coordinates there may be any number of \fIoption\fR\-\fIvalue\fR
1523pairs, each of which sets one of the configuration options
1524for the item. These same \fIoption\fR\-\fIvalue\fR pairs may be
1525used in \fBitemconfigure\fR widget commands to change the item's
1526configuration.
1527.br
1528The following standard options are supported by images:
1529.CS
1530\-state
1531\-tags
1532.CE
1533The following extra options are supported for images:
1534.TP
1535\fB\-anchor \fIanchorPos\fR
1536\fIAnchorPos\fR tells how to position the image relative to the
1537positioning point for the item; it may have any of the forms
1538accepted by \fBTk_GetAnchor\fR. For example, if \fIanchorPos\fR
1539is \fBcenter\fR then the image is centered on the point; if
1540\fIanchorPos\fR is \fBn\fR then the image will be drawn so that
1541its top center point is at the positioning point.
1542This option defaults to \fBcenter\fR.
1543.TP
1544\fB\-image \fIname\fR
1545.TP
1546\fB\-activeimage \fIname\fR
1547.TP
1548\fB\-disabledimage \fIname\fR
1549Specifies the name of the images to display in the item in is normal,
1550active and disabled states.
1551This image must have been created previously with the
1552\fBimage create\fR command.
1553.SH "LINE ITEMS"
1554.PP
1555Items of type \fBline\fR appear on the display as one or more connected
1556line segments or curves.
1557Line items support coordinate indexing operations using the canvas
1558widget commands: \fBdchars, index, insert.\fR
1559Lines are created with widget commands of the following form:
1560.CS
1561\fIpathName \fBcreate line \fIx1 y1... xn yn \fR?\fIoption value option value ...\fR?
1562\fIpathName \fBcreate line \fIcoordList\fR ?\fIoption value option value ...\fR?
1563.CE
1564The arguments \fIx1\fR through \fIyn\fR or \fIcoordList\fR give
1565the coordinates for a series of two or more points that describe
1566a series of connected line segments.
1567After the coordinates there may be any number of \fIoption\fR\-\fIvalue\fR
1568pairs, each of which sets one of the configuration options
1569for the item. These same \fIoption\fR\-\fIvalue\fR pairs may be
1570used in \fBitemconfigure\fR widget commands to change the item's
1571configuration.
1572.br
1573The following standard options are supported by lines:
1574.CS
1575\-dash
1576\-activedash
1577\-disableddash
1578\-dashoffset
1579\-fill
1580\-activefill
1581\-disabledfill
1582\-stipple
1583\-activestipple
1584\-disabledstipple
1585\-state
1586\-tags
1587\-width
1588\-activewidth
1589\-disabledwidth
1590.CE
1591The following extra options are supported for lines:
1592.TP
1593\fB\-arrow \fIwhere\fR
1594Indicates whether or not arrowheads are to be drawn at one or both
1595ends of the line.
1596\fIWhere\fR must have one of the values \fBnone\fR (for no arrowheads),
1597\fBfirst\fR (for an arrowhead at the first point of the line),
1598\fBlast\fR (for an arrowhead at the last point of the line), or
1599\fBboth\fR (for arrowheads at both ends).
1600This option defaults to \fBnone\fR.
1601.TP
1602\fB\-arrowshape \fIshape\fR
1603This option indicates how to draw arrowheads.
1604The \fIshape\fR argument must be a list with three elements, each
1605specifying a distance in any of the forms described in
1606the \fBCOORDINATES\fR section above.
1607The first element of the list gives the distance along the line
1608from the neck of the arrowhead to its tip.
1609The second element gives the distance along the line from the
1610trailing points of the arrowhead to the tip, and the third
1611element gives the distance from the outside edge of the line to the
1612trailing points.
1613If this option isn't specified then Tk picks a ``reasonable'' shape.
1614.TP
1615\fB\-capstyle \fIstyle\fR
1616Specifies the ways in which caps are to be drawn at the endpoints
1617of the line.
1618\fIStyle\fR may have any of the forms accepted by \fBTk_GetCapStyle\fR
1619(\fBbutt\fR, \fBprojecting\fR, or \fBround\fR).
1620If this option isn't specified then it defaults to \fBbutt\fR.
1621Where arrowheads are drawn the cap style is ignored.
1622.TP
1623\fB\-joinstyle \fIstyle\fR
1624Specifies the ways in which joints are to be drawn at the vertices
1625of the line.
1626\fIStyle\fR may have any of the forms accepted by \fBTk_GetCapStyle\fR
1627(\fBbevel\fR, \fBmiter\fR, or \fBround\fR).
1628If this option isn't specified then it defaults to \fBmiter\fR.
1629If the line only contains two points then this option is
1630irrelevant.
1631.TP
1632\fB\-smooth \fIsmoothMethod\fR
1633\fIsmoothMethod\fR must have one of the forms accepted by
1634\fBTcl_GetBoolean\fR or a line smoothing method. Only \fBbezier\fR is
1635supported in the core, but more can be added at runtime. If a boolean
1636false value or empty string is given, no smoothing is applied. A boolean
1637truth value assume \fBbezier\fR smoothing.
1638It indicates whether or not the line should be drawn as a curve.
1639If so, the line is rendered as a set of parabolic splines: one spline
1640is drawn for the first and second line segments, one for the second
1641and third, and so on. Straight-line segments can be generated within
1642a curve by duplicating the end-points of the desired line segment.
1643.TP
1644\fB\-splinesteps \fInumber\fR
1645Specifies the degree of smoothness desired for curves: each spline
1646will be approximated with \fInumber\fR line segments. This
1647option is ignored unless the \fB\-smooth\fR option is true.
1648
1649.SH "OVAL ITEMS"
1650.PP
1651Items of type \fBoval\fR appear as circular or oval regions on
1652the display. Each oval may have an outline, a fill, or
1653both. Ovals are created with widget commands of the
1654following form:
1655.CS
1656\fIpathName \fBcreate oval \fIx1 y1 x2 y2 \fR?\fIoption value option value ...\fR?
1657\fIpathName \fBcreate oval \fIcoordList\fR ?\fIoption value option value ...\fR?
1658.CE
1659The arguments \fIx1\fR, \fIy1\fR, \fIx2\fR, and \fIy2\fR or \fIcoordList\fR give
1660the coordinates of two diagonally opposite corners of a
1661rectangular region enclosing the oval.
1662The oval will include the top and left edges of the rectangle
1663not the lower or right edges.
1664If the region is square then the resulting oval is circular;
1665otherwise it is elongated in shape.
1666After the coordinates there may be any number of \fIoption\fR\-\fIvalue\fR
1667pairs, each of which sets one of the configuration options
1668for the item. These same \fIoption\fR\-\fIvalue\fR pairs may be
1669used in \fBitemconfigure\fR widget commands to change the item's
1670configuration.
1671.br
1672The following standard options are supported by ovals:
1673.CS
1674\-dash
1675\-activedash
1676\-disableddash
1677\-dashoffset
1678\-fill
1679\-activefill
1680\-disabledfill
1681\-offset
1682\-outline
1683\-activeoutline
1684\-disabledoutline
1685\-outlinestipple
1686\-activeoutlinestipple
1687\-disabledoutlinestipple
1688\-stipple
1689\-activestipple
1690\-disabledstipple
1691\-state
1692\-tags
1693\-width
1694\-activewidth
1695\-disabledwidth
1696.CE
1697.SH "POLYGON ITEMS"
1698.PP
1699Items of type \fBpolygon\fR appear as polygonal or curved filled regions
1700on the display.
1701Polygon items support coordinate indexing operations using the canvas
1702widget commands: \fBdchars, index, insert.\fR
1703Polygons are created with widget commands of the following form:
1704.CS
1705\fIpathName \fBcreate polygon \fIx1 y1 ... xn yn \fR?\fIoption value option value ...\fR?
1706\fIpathName \fBcreate polygon \fIcoordList\fR ?\fIoption value option value ...\fR?
1707.CE
1708The arguments \fIx1\fR through \fIyn\fR or \fIcoordList\fR specify the coordinates for
1709three or more points that define a polygon.
1710The first point should not be repeated as the last to
1711close the shape; Tk will automatically close the periphery between
1712the first and last points.
1713After the coordinates there may be any number of \fIoption\fR\-\fIvalue\fR
1714pairs, each of which sets one of the configuration options
1715for the item. These same \fIoption\fR\-\fIvalue\fR pairs may be
1716used in \fBitemconfigure\fR widget commands to change the item's
1717configuration.
1718.br
1719The following standard options are supported by polygons:
1720.CS
1721\-dash
1722\-activedash
1723\-disableddash
1724\-dashoffset
1725\-fill
1726\-activefill
1727\-disabledfill
1728\-offset
1729\-outline
1730\-activeoutline
1731\-disabledoutline
1732\-outlinestipple
1733\-activeoutlinestipple
1734\-disabledoutlinestipple
1735\-stipple
1736\-activestipple
1737\-disabledstipple
1738\-state
1739\-tags
1740\-width
1741\-activewidth
1742\-disabledwidth
1743.CE
1744The following extra options are supported for polygons:
1745.TP
1746\fB\-joinstyle \fIstyle\fR
1747Specifies the ways in which joints are to be drawn at the vertices
1748of the outline.
1749\fIStyle\fR may have any of the forms accepted by \fBTk_GetCapStyle\fR
1750(\fBbevel\fR, \fBmiter\fR, or \fBround\fR).
1751If this option isn't specified then it defaults to \fBmiter\fR.
1752.TP
1753\fB\-smooth \fIboolean\fR
1754\fIBoolean\fR must have one of the forms accepted by \fBTcl_GetBoolean\fR.
1755It indicates whether or not the polygon should be drawn with a
1756curved perimeter.
1757If so, the outline of the polygon becomes a set of parabolic splines,
1758one spline for the first and second line segments, one for the second
1759and third, and so on. Straight-line segments can be generated in a
1760smoothed polygon by duplicating the end-points of the desired line segment.
1761.TP
1762\fB\-splinesteps \fInumber\fR
1763Specifies the degree of smoothness desired for curves: each spline
1764will be approximated with \fInumber\fR line segments. This
1765option is ignored unless the \fB\-smooth\fR option is true.
1766.PP
1767Polygon items are different from other items such as rectangles, ovals
1768and arcs in that interior points are considered to be ``inside'' a
1769polygon (e.g. for purposes of the \fBfind closest\fR and
1770\fBfind overlapping\fR widget commands) even if it is not filled.
1771For most other item types, an
1772interior point is considered to be inside the item only if the item
1773is filled or if it has neither a fill nor an outline. If you would
1774like an unfilled polygon whose interior points are not considered
1775to be inside the polygon, use a line item instead.
1776.SH "RECTANGLE ITEMS"
1777.PP
1778Items of type \fBrectangle\fR appear as rectangular regions on
1779the display. Each rectangle may have an outline, a fill, or
1780both. Rectangles are created with widget commands of the
1781following form:
1782.CS
1783\fIpathName \fBcreate rectangle \fIx1 y1 x2 y2 \fR?\fIoption value option value ...\fR?
1784\fIpathName \fBcreate rectangle \fIcoordList\fR ?\fIoption value option value ...\fR?
1785.CE
1786The arguments \fIx1\fR, \fIy1\fR, \fIx2\fR, and \fIy2\fR or \fIcoordList\fR give
1787the coordinates of two diagonally opposite corners of the rectangle
1788(the rectangle will include its upper and left edges but not
1789its lower or right edges).
1790After the coordinates there may be any number of \fIoption\fR\-\fIvalue\fR
1791pairs, each of which sets one of the configuration options
1792for the item. These same \fIoption\fR\-\fIvalue\fR pairs may be
1793used in \fBitemconfigure\fR widget commands to change the item's
1794configuration.
1795.br
1796The following standard options are supported by rectangles:
1797.CS
1798\-dash
1799\-activedash
1800\-disableddash
1801\-dashoffset
1802\-fill
1803\-activefill
1804\-disabledfill
1805\-offset
1806\-outline
1807\-activeoutline
1808\-disabledoutline
1809\-outlinestipple
1810\-activeoutlinestipple
1811\-disabledoutlinestipple
1812\-stipple
1813\-activestipple
1814\-disabledstipple
1815\-state
1816\-tags
1817\-width
1818\-activewidth
1819\-disabledwidth
1820.CE
1821.SH "TEXT ITEMS"
1822.PP
1823A text item displays a string of characters on the screen in one
1824or more lines.
1825Text items support indexing and selection, along with the
1826following text-related canvas widget commands: \fBdchars\fR,
1827\fBfocus\fR, \fBicursor\fR, \fBindex\fR, \fBinsert\fR,
1828\fBselect\fR.
1829Text items are created with widget commands of the following
1830form:
1831.CS
1832\fIpathName \fBcreate text \fIx y \fR?\fIoption value option value ...\fR?
1833\fIpathName \fBcreate text \fIcoordList\fR ?\fIoption value option value ...\fR?
1834.CE
1835The arguments \fIx\fR and \fIy\fR or \fIcoordList\fR specify the coordinates of a
1836point used to position the text on the display (see the options
1837below for more information on how text is displayed).
1838After the coordinates there may be any number of \fIoption\fR\-\fIvalue\fR
1839pairs, each of which sets one of the configuration options
1840for the item. These same \fIoption\fR\-\fIvalue\fR pairs may be
1841used in \fBitemconfigure\fR widget commands to change the item's
1842configuration.
1843.br
1844The following standard options are supported by text items:
1845.CS
1846\-fill
1847\-activefill
1848\-disabledfill
1849\-stipple
1850\-activestipple
1851\-disabledstipple
1852\-state
1853\-tags
1854.CE
1855The following extra options are supported for text items:
1856.TP
1857\fB\-anchor \fIanchorPos\fR
1858\fIAnchorPos\fR tells how to position the text relative to the
1859positioning point for the text; it may have any of the forms
1860accepted by \fBTk_GetAnchor\fR. For example, if \fIanchorPos\fR
1861is \fBcenter\fR then the text is centered on the point; if
1862\fIanchorPos\fR is \fBn\fR then the text will be drawn such that
1863the top center point of the rectangular region occupied by the
1864text will be at the positioning point.
1865This option defaults to \fBcenter\fR.
1866.TP
1867\fB\-font \fIfontName\fR
1868Specifies the font to use for the text item.
1869\fIFontName\fR may be any string acceptable to \fBTk_GetFont\fR.
1870If this option isn't specified, it defaults to a system-dependent
1871font.
1872.TP
1873\fB\-justify \fIhow\fR
1874Specifies how to justify the text within its bounding region.
1875\fIHow\fR must be one of the values \fBleft\fR, \fBright\fR,
1876or \fBcenter\fR.
1877This option will only matter if the text is displayed as multiple
1878lines.
1879If the option is omitted, it defaults to \fBleft\fR.
1880.TP
1881\fB\-text \fIstring\fR
1882\fIString\fR specifies the characters to be displayed in the text item.
1883Newline characters cause line breaks.
1884The characters in the item may also be changed with the
1885\fBinsert\fR and \fBdelete\fR widget commands.
1886This option defaults to an empty string.
1887.TP
1888\fB\-width \fIlineLength\fR
1889Specifies a maximum line length for the text, in any of the forms
1890described in the \fBCOORDINATES\fR section above.
1891If this option is zero (the default) the text is broken into
1892lines only at newline characters.
1893However, if this option is non-zero then any line that would
1894be longer than \fIlineLength\fR is broken just before a space
1895character to make the line shorter than \fIlineLength\fR; the
1896space character is treated as if it were a newline
1897character.
1898.SH "WINDOW ITEMS"
1899.PP
1900Items of type \fBwindow\fR cause a particular window to be displayed
1901at a given position on the canvas.
1902Window items are created with widget commands of the following form:
1903.CS
1904\fIpathName \fBcreate window \fIx y \fR?\fIoption value option value ...\fR?
1905\fIpathName \fBcreate window \fIcoordList\fR ?\fIoption value option value ...\fR?
1906.CE
1907The arguments \fIx\fR and \fIy\fR or \fIcoordList\fR specify the coordinates of a
1908point used to position the window on the display (see the \fB\-anchor\fR
1909option below for more information on how bitmaps are displayed).
1910After the coordinates there may be any number of \fIoption\fR\-\fIvalue\fR
1911pairs, each of which sets one of the configuration options
1912for the item. These same \fIoption\fR\-\fIvalue\fR pairs may be
1913used in \fBitemconfigure\fR widget commands to change the item's
1914configuration.
1915.br
1916The following standard options are supported by window items:
1917.CS
1918\-state
1919\-tags
1920.CE
1921The following extra options are supported for window items:
1922.TP
1923\fB\-anchor \fIanchorPos\fR
1924\fIAnchorPos\fR tells how to position the window relative to the
1925positioning point for the item; it may have any of the forms
1926accepted by \fBTk_GetAnchor\fR. For example, if \fIanchorPos\fR
1927is \fBcenter\fR then the window is centered on the point; if
1928\fIanchorPos\fR is \fBn\fR then the window will be drawn so that
1929its top center point is at the positioning point.
1930This option defaults to \fBcenter\fR.
1931.TP
1932\fB\-height \fIpixels\fR
1933Specifies the height to assign to the item's window.
1934\fIPixels\fR may have any of the
1935forms described in the \fBCOORDINATES\fR section above.
1936If this option isn't specified, or if it is specified as an empty
1937string, then the window is given whatever height it requests internally.
1938.TP
1939\fB\-width \fIpixels\fR
1940Specifies the width to assign to the item's window.
1941\fIPixels\fR may have any of the
1942forms described in the \fBCOORDINATES\fR section above.
1943If this option isn't specified, or if it is specified as an empty
1944string, then the window is given whatever width it requests internally.
1945.TP
1946\fB\-window \fIpathName\fR
1947Specifies the window to associate with this item.
1948The window specified by \fIpathName\fR must either be a child of
1949the canvas widget or a child of some ancestor of the canvas widget.
1950\fIPathName\fR may not refer to a top-level window.
1951.PP
1952Note: due to restrictions in the ways that windows are managed, it is not
1953possible to draw other graphical items (such as lines and images) on top
1954of window items. A window item always obscures any graphics that
1955overlap it, regardless of their order in the display list.
1956.SH "APPLICATION-DEFINED ITEM TYPES"
1957.PP
1958It is possible for individual applications to define new item
1959types for canvas widgets using C code.
1960See the documentation for \fBTk_CreateItemType\fR.
1961.SH BINDINGS
1962.PP
1963In the current implementation, new canvases are not given any
1964default behavior: you'll have to execute explicit Tcl commands
1965to give the canvas its behavior.
1966.SH CREDITS
1967.PP
1968Tk's canvas widget is a blatant ripoff of ideas from Joel Bartlett's
1969\fIezd\fR program. \fIEzd\fR provides structured graphics in a Scheme
1970environment and preceded canvases by a year or two. Its simple
1971mechanisms for placing and animating graphical objects inspired the
1972functions of canvases.
1973
1974.SH "SEE ALSO"
1975bind(n), font(n), image(n), scrollbar(n)
1976
1977.SH KEYWORDS
1978canvas, widget