OSDN Git Service

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