canvas.n
上传用户:rrhhcc
上传日期:2015-12-11
资源大小:54129k
文件大小:73k
- '"
- '" Copyright (c) 1992-1994 The Regents of the University of California.
- '" Copyright (c) 1994-1996 Sun Microsystems, Inc.
- '" Copyright (c) 1997-1999 Scriptics Corporation.
- '"
- '" See the file "license.terms" for information on usage and redistribution
- '" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
- '"
- '" RCS: @(#) $Id: canvas.n,v 1.13.2.4 2007/11/05 17:21:58 dgp Exp $
- '"
- .so man.macros
- .TH canvas n 8.3 Tk "Tk Built-In Commands"
- .BS
- '" Note: do not modify the .SH NAME line immediately below!
- .SH NAME
- canvas - Create and manipulate canvas widgets
- .SH SYNOPSIS
- fBcanvasfR fIpathName fR?fIoptionsfR?
- .SO
- -background -insertborderwidth -selectborderwidth
- -borderwidth -insertofftime -selectforeground
- -cursor -insertontime -takefocus
- -highlightbackground -insertwidth -xscrollcommand
- -highlightcolor -relief -yscrollcommand
- -highlightthickness -state
- -insertbackground -selectbackground
- .SE
- .SH "WIDGET-SPECIFIC OPTIONS"
- .OP -closeenough closeEnough CloseEnough
- Specifies a floating-point value indicating how close the mouse cursor
- must be to an item before it is considered to be ``inside'' the item.
- Defaults to 1.0.
- .OP -confine confine Confine
- Specifies a boolean value that indicates whether or not it should be
- allowable to set the canvas's view outside the region defined by the
- fBscrollRegionfR argument.
- Defaults to true, which means that the view will
- be constrained within the scroll region.
- .OP -height height Height
- Specifies a desired window height that the canvas widget should request from
- its geometry manager. The value may be specified in any
- of the forms described in the fBCOORDINATESfR section below.
- .OP -scrollregion scrollRegion ScrollRegion
- Specifies a list with four coordinates describing the left, top, right, and
- bottom coordinates of a rectangular region.
- This region is used for scrolling purposes and is considered to be
- the boundary of the information in the canvas.
- Each of the coordinates may be specified
- in any of the forms given in the fBCOORDINATESfR section below.
- .OP -state state State
- Modifies the default state of the canvas where fIstatefR may be set to
- one of: fBnormalfR, fBdisabledfR, or fBhiddenfR. Individual canvas
- objects all have their own state option which may override the default
- state. Many options can take separate specifications such that the
- appearance of the item can be different in different situations. The
- options that start with fBactivefR control the appearance when the mouse
- pointer is over it, while the option starting with fBdisabledfR controls
- the appearance when the state is disabled. Canvas items which are
- fBdisabledfR will not react to canvas bindings.
- .OP -width width width
- Specifies a desired window width that the canvas widget should request from
- its geometry manager. The value may be specified in any
- of the forms described in the fBCOORDINATESfR section below.
- .OP -xscrollincrement xScrollIncrement ScrollIncrement
- Specifies an increment for horizontal scrolling, in any of the usual forms
- permitted for screen distances. If the value of this option is greater
- than zero, the horizontal view in the window will be constrained so that
- the canvas x coordinate at the left edge of the window is always an even
- multiple of fBxScrollIncrementfR; furthermore, the units for scrolling
- (e.g., the change in view when the left and right arrows of a scrollbar
- are selected) will also be fBxScrollIncrementfR. If the value of
- this option is less than or equal to zero, then horizontal scrolling
- is unconstrained.
- .OP -yscrollincrement yScrollIncrement ScrollIncrement
- Specifies an increment for vertical scrolling, in any of the usual forms
- permitted for screen distances. If the value of this option is greater
- than zero, the vertical view in the window will be constrained so that
- the canvas y coordinate at the top edge of the window is always an even
- multiple of fByScrollIncrementfR; furthermore, the units for scrolling
- (e.g., the change in view when the top and bottom arrows of a scrollbar
- are selected) will also be fByScrollIncrementfR. If the value of
- this option is less than or equal to zero, then vertical scrolling
- is unconstrained.
- .BE
- .SH INTRODUCTION
- .PP
- The fBcanvasfR command creates a new window (given
- by the fIpathNamefR argument) and makes it into a canvas widget.
- Additional options, described above, may be specified on the
- command line or in the option database
- to configure aspects of the canvas such as its colors and 3-D relief.
- The fBcanvasfR command returns its
- fIpathNamefR argument. At the time this command is invoked,
- there must not exist a window named fIpathNamefR, but
- fIpathNamefR's parent must exist.
- .PP
- Canvas widgets implement structured graphics.
- A canvas displays any number of fIitemsfR, which may be things like
- rectangles, circles, lines, and text.
- Items may be manipulated (e.g. moved or re-colored) and commands may
- be associated with items in much the same way that the fBbindfR
- command allows commands to be bound to widgets. For example,
- a particular command may be associated with the <Button-1> event
- so that the command is invoked whenever button 1 is pressed with
- the mouse cursor over an item.
- This means that items in a canvas can have behaviors defined by
- the Tcl scripts bound to them.
- .SH "DISPLAY LIST"
- .PP
- The items in a canvas are ordered for purposes of display,
- with the first item in the display list being displayed
- first, followed by the next item in the list, and so on.
- Items later in the display list obscure those that are
- earlier in the display list and are sometimes referred to
- as being ``on top'' of earlier items.
- When a new item is created it is placed at the end of the
- display list, on top of everything else.
- Widget commands may be used to re-arrange the order of the
- display list.
- .PP
- Window items are an exception to the above rules. The underlying
- window systems require them always to be drawn on top of other items.
- In addition, the stacking order of window items
- is not affected by any of the canvas widget commands; you must use
- the fBraisefR and fBlowerfR Tk commands instead.
- .SH "ITEM IDS AND TAGS"
- .PP
- Items in a canvas widget may be named in either of two ways:
- by id or by tag.
- Each item has a unique identifying number, which is assigned to
- that item when it is created. The id of an item never changes
- and id numbers are never re-used within the lifetime of a
- canvas widget.
- .PP
- Each item may also have any number of fItagsfR associated
- with it. A tag is just a string of characters, and it may
- take any form except that of an integer.
- For example, ``x123'' is OK but ``123'' isn't.
- The same tag may be associated with many different items.
- This is commonly done to group items in various interesting
- ways; for example, all selected items might be given the
- tag ``selected''.
- .PP
- The tag fBallfR is implicitly associated with every item
- in the canvas; it may be used to invoke operations on
- all the items in the canvas.
- .PP
- The tag fBcurrentfR is managed automatically by Tk;
- it applies to the fIcurrent itemfR, which is the
- topmost item whose drawn area covers the position of
- the mouse cursor.
- If the mouse is not in the canvas widget or is not over
- an item, then no item has the fBcurrentfR tag.
- .PP
- When specifying items in canvas widget commands, if the
- specifier is an integer then it is assumed to refer to
- the single item with that id.
- If the specifier is not an integer, then it is assumed to
- refer to all of the items in the canvas that have a tag
- matching the specifier.
- The symbol fItagOrIdfR is used below to indicate that
- an argument specifies either an id that selects a single
- item or a tag that selects zero or more items.
- .PP
- fItagOrIdfR may contain a logical expressions of
- tags by using operators: '&&', '||', '^' '!', and parenthesized
- subexpressions. For example:
- .CS
- .c find withtag {(a&&!b)||(!a&&b)}
- .CE
- or equivalently:
- .CS
- .c find withtag {a^b}
- .CE
- will find only those items with either "a" or "b" tags, but not both.
- .PP
- Some widget commands only operate on a single item at a
- time; if fItagOrIdfR is specified in a way that
- names multiple items, then the normal behavior is for
- the command to use the first (lowest) of these items in
- the display list that is suitable for the command.
- Exceptions are noted in the widget command descriptions
- below.
- .SH "COORDINATES"
- .PP
- All coordinates related to canvases are stored as floating-point
- numbers.
- Coordinates and distances are specified in screen units,
- which are floating-point numbers optionally followed
- by one of several letters.
- If no letter is supplied then the distance is in pixels.
- If the letter is fBmfR then the distance is in millimeters on
- the screen; if it is fBcfR then the distance is in centimeters;
- fBifR means inches, and fBpfR means printers points (1/72 inch).
- Larger y-coordinates refer to points lower on the screen; larger
- x-coordinates refer to points farther to the right.
- .VS
- Coordinates can be specified either as an even number of parameters,
- or as a single list parameter containing an even number of x and y
- coordinate values.
- .VE
- .SH TRANSFORMATIONS
- .PP
- Normally the origin of the canvas coordinate system is at the
- upper-left corner of the window containing the canvas.
- It is possible to adjust the origin of the canvas
- coordinate system relative to the origin of the window using the
- fBxviewfR and fByviewfR widget commands; this is typically used
- for scrolling.
- Canvases do not support scaling or rotation of the canvas coordinate
- system relative to the window coordinate system.
- .PP
- Individual items may be moved or scaled using widget commands
- described below, but they may not be rotated.
- .PP
- Note that the default origin of the canvas's visible area is
- coincident with the origin for the whole window as that makes bindings
- using the mouse position easier to work with; you only need to use the
- fBcanvasxfR and fBcanvasyfR widget commands if you adjust the
- origin of the visible area. However, this also means that any focus
- ring (as controlled by the fB-highlightthicknessfR option) and
- window border (as controlled by the fB-borderwidthfR option) must
- be taken into account before you get to the visible area of the
- canvas.
- .SH "INDICES"
- .PP
- Text items support the notion of an fIindexfR for identifying
- particular positions within the item.
- In a similar fashion, line and polygon items support fIindexfR for
- identifying, inserting and deleting subsets of their coordinates.
- Indices are used for commands such as inserting or deleting
- a range of characters or coordinates, and setting the insertion
- cursor position. An index may be specified in any of a number
- of ways, and different types of items may support different forms
- for specifying indices.
- Text items support the following forms for an index; if you
- define new types of text-like items, it would be advisable to
- support as many of these forms as practical.
- Note that it is possible to refer to the character just after
- the last one in the text item; this is necessary for such
- tasks as inserting new text at the end of the item.
- Lines and Polygons don't support the insertion cursor
- and the selection. Their indices are supposed to be even
- always, because coordinates always appear in pairs.
- .TP 10
- fInumberfR
- A decimal number giving the position of the desired character
- within the text item.
- 0 refers to the first character, 1 to the next character, and
- so on. If indexes are odd for lines and polygons, they will be
- automatically decremented by one.
- A number less than 0 is treated as if it were zero, and a
- number greater than the length of the text item is treated
- as if it were equal to the length of the text item. For
- polygons, numbers less than 0 or greater then the length
- of the coordinate list will be adjusted by adding or subtracting
- the length until the result is between zero and the length,
- inclusive.
- .TP 10
- fBendfR
- Refers to the character or coordinate just after the last one
- in the item (same as the number of characters or coordinates
- in the item).
- .TP 10
- fBinsertfR
- Refers to the character just before which the insertion cursor
- is drawn in this item. Not valid for lines and polygons.
- .TP 10
- fBsel.firstfR
- Refers to the first selected character in the item.
- If the selection isn't in this item then this form is illegal.
- .TP 10
- fBsel.lastfR
- Refers to the last selected character in the item.
- If the selection isn't in this item then this form is illegal.
- .TP 10
- fB@fIx,yfR
- Refers to the character or coordinate at the point given by fIxfR and
- fIyfR, where fIxfR and fIyfR are specified in the coordinate
- system of the canvas.
- If fIxfR and fIyfR lie outside the coordinates covered by the
- text item, then they refer to the first or last character in the
- line that is closest to the given point.
- .SH "DASH PATTERNS"
- .PP
- Many items support the notion of a dash pattern for outlines.
- .PP
- The first possible syntax is a list of integers. Each element
- represents the number of pixels of a line segment. Only the odd
- segments are drawn using the "outline" color. The other segments
- are drawn transparent.
- .PP
- The second possible syntax is a character list containing only
- 5 possible characters fB[.,-_ ]fR. The space can be used
- to enlarge the space between other line elements, and can not
- occur as the first position in the string. Some examples:
- -dash . = -dash {2 4}
- -dash - = -dash {6 4}
- -dash -. = -dash {6 4 2 4}
- -dash -.. = -dash {6 4 2 4 2 4}
- -dash {. } = -dash {2 8}
- -dash , = -dash {4 4}
- .PP
- The main difference of this syntax with the previous is that it
- is shape-conserving. This means that all values in the dash
- list will be multiplied by the line width before display. This
- assures that "." will always be displayed as a dot and "-"
- always as a dash regardless of the line width.
- .PP
- On systems which support only a limited set of dash patterns, the dash
- pattern will be displayed as the closest dash pattern that is available.
- For example, on Windows only the first 4 of the above examples are
- available. The last 2 examples will be displayed identically to the first
- one.
- .SH "WIDGET COMMAND"
- .PP
- The fBcanvasfR command creates a new Tcl command whose
- name is fIpathNamefR. This
- command may be used to invoke various
- operations on the widget. It has the following general form:
- .CS
- fIpathName option fR?fIarg arg ...fR?
- .CE
- fIOptionfR and the fIargfRs
- determine the exact behavior of the command.
- The following widget commands are possible for canvas widgets:
- .TP
- fIpathName fBaddtag fItag searchSpec fR?fIarg arg ...fR?
- For each item that meets the constraints specified by
- fIsearchSpecfR and the fIargfRs, add
- fItagfR to the list of tags associated with the item if it
- isn't already present on that list.
- It is possible that no items will satisfy the constraints
- given by fIsearchSpecfR and fIargfRs, in which case the
- command has no effect.
- This command returns an empty string as result.
- fISearchSpecfR and fIargfR's may take any of the following
- forms:
- .RS
- .TP
- fBabove fItagOrIdfR
- Selects the item just after (above) the one given by fItagOrIdfR
- in the display list.
- If fItagOrIdfR denotes more than one item, then the last (topmost)
- of these items in the display list is used.
- .TP
- fBallfR
- Selects all the items in the canvas.
- .TP
- fBbelow fItagOrIdfR
- Selects the item just before (below) the one given by fItagOrIdfR
- in the display list.
- If fItagOrIdfR denotes more than one item, then the first (lowest)
- of these items in the display list is used.
- .TP
- fBclosest fIx y fR?fIhalofR? ?fIstartfR?
- Selects the item closest to the point given by fIxfR and fIyfR.
- If more than one item is at the same closest distance (e.g. two
- items overlap the point), then the top-most of these items (the
- last one in the display list) is used.
- If fIhalofR is specified, then it must be a non-negative
- value.
- Any item closer than fIhalofR to the point is considered to
- overlap it.
- The fIstartfR argument may be used to step circularly through
- all the closest items.
- If fIstartfR is specified, it names an item using a tag or id
- (if by tag, it selects the first item in the display list with
- the given tag).
- Instead of selecting the topmost closest item, this form will
- select the topmost closest item that is below fIstartfR in
- the display list; if no such item exists, then the selection
- behaves as if the fIstartfR argument had not been specified.
- .TP
- fBenclosedfR fIx1fR fIy1fR fIx2fR fIy2fR
- Selects all the items completely enclosed within the rectangular
- region given by fIx1fR, fIy1fR, fIx2fR, and fIy2fR.
- fIX1fR must be no greater then fIx2fR and fIy1fR must be
- no greater than fIy2fR.
- .TP
- fBoverlappingfR fIx1fR fIy1fR fIx2fR fIy2fR
- Selects all the items that overlap or are enclosed within the
- rectangular region given by fIx1fR, fIy1fR, fIx2fR,
- and fIy2fR.
- fIX1fR must be no greater then fIx2fR and fIy1fR must be
- no greater than fIy2fR.
- .TP
- fBwithtag fItagOrIdfR
- Selects all the items given by fItagOrIdfR.
- .RE
- .TP
- fIpathName fBbbox fItagOrIdfR ?fItagOrId tagOrId ...fR?
- Returns a list with four elements giving an approximate bounding box
- for all the items named by the fItagOrIdfR arguments.
- The list has the form ``fIx1 y1 x2 y2fR'' such that the drawn
- areas of all the named elements are within the region bounded by
- fIx1fR on the left, fIx2fR on the right, fIy1fR on the top,
- and fIy2fR on the bottom.
- The return value may overestimate the actual bounding box by
- a few pixels.
- If no items match any of the fItagOrIdfR arguments or if the
- matching items have empty bounding boxes (i.e. they have nothing
- to display)
- then an empty string is returned.
- .TP
- fIpathName fBbind fItagOrIdfR ?fIsequencefR? ?fIcommandfR?
- This command associates fIcommandfR with all the items given by
- fItagOrIdfR such that whenever the event sequence given by
- fIsequencefR occurs for one of the items the command will
- be invoked.
- This widget command is similar to the fBbindfR command except that
- it operates on items in a canvas rather than entire widgets.
- See the fBbindfR manual entry for complete details
- on the syntax of fIsequencefR and the substitutions performed
- on fIcommandfR before invoking it.
- If all arguments are specified then a new binding is created, replacing
- any existing binding for the same fIsequencefR and fItagOrIdfR
- (if the first character of fIcommandfR is ``+'' then fIcommandfR
- augments an existing binding rather than replacing it).
- In this case the return value is an empty string.
- If fIcommandfR is omitted then the command returns the fIcommandfR
- associated with fItagOrIdfR and fIsequencefR (an error occurs
- if there is no such binding).
- If both fIcommandfR and fIsequencefR are omitted then the command
- returns a list of all the sequences for which bindings have been
- defined for fItagOrIdfR.
- .RS
- .PP
- The only events for which bindings may be specified are those related to
- the mouse and keyboard (such as fBEnterfR, fBLeavefR,
- fBButtonPressfR, fBMotionfR, and fBKeyPressfR) or virtual events.
- The handling of events in canvases uses the current item defined in ITEM
- IDS AND TAGS above. fBEnterfR and fBLeavefR events trigger for an
- item when it becomes the current item or ceases to be the current item;
- note that these events are different than fBEnterfR and fBLeavefR
- events for windows. Mouse-related events are directed to the current
- item, if any. Keyboard-related events are directed to the focus item, if
- any (see the fBfocusfR widget command below for more on this). If a
- virtual event is used in a binding, that binding can trigger only if the
- virtual event is defined by an underlying mouse-related or
- keyboard-related event.
- .PP
- It is possible for multiple bindings to match a particular event.
- This could occur, for example, if one binding is associated with the
- item's id and another is associated with one of the item's tags.
- When this occurs, all of the matching bindings are invoked.
- A binding associated with the fBallfR tag is invoked first,
- followed by one binding for each of the item's tags (in order),
- followed by a binding associated with the item's id.
- If there are multiple matching bindings for a single tag,
- then only the most specific binding is invoked.
- A fBcontinuefR command in a binding script terminates that
- script, and a fBbreakfR command terminates that script
- and skips any remaining scripts for the event, just as for the
- fBbindfR command.
- .PP
- If bindings have been created for a canvas window using the fBbindfR
- command, then they are invoked in addition to bindings created for
- the canvas's items using the fBbindfR widget command.
- The bindings for items will be invoked before any of the bindings
- for the window as a whole.
- .RE
- .TP
- fIpathName fBcanvasx fIscreenxfR ?fIgridspacingfR?
- Given a window x-coordinate in the canvas fIscreenxfR, this command returns
- the canvas x-coordinate that is displayed at that location.
- If fIgridspacingfR is specified, then the canvas coordinate is
- rounded to the nearest multiple of fIgridspacingfR units.
- .TP
- fIpathName fBcanvasy fIscreenyfR ?fIgridspacingfR?
- Given a window y-coordinate in the canvas fIscreenyfR this command returns
- the canvas y-coordinate that is displayed at that location.
- If fIgridspacingfR is specified, then the canvas coordinate is
- rounded to the nearest multiple of fIgridspacingfR units.
- .TP
- fIpathName fBcgetfR fIoptionfR
- Returns the current value of the configuration option given
- by fIoptionfR.
- fIOptionfR may have any of the values accepted by the fBcanvasfR
- command.
- .TP
- fIpathName fBconfigure ?fIoptionfR? ?fIvaluefR? ?fIoption value ...fR?
- Query or modify the configuration options of the widget.
- If no fIoptionfR is specified, returns a list describing all of
- the available options for fIpathNamefR (see fBTk_ConfigureInfofR for
- information on the format of this list). If fIoptionfR is specified
- with no fIvaluefR, then the command returns a list describing the
- one named option (this list will be identical to the corresponding
- sublist of the value returned if no fIoptionfR is specified). If
- one or more fIoption-valuefR pairs are specified, then the command
- modifies the given widget option(s) to have the given value(s); in
- this case the command returns an empty string.
- fIOptionfR may have any of the values accepted by the fBcanvasfR
- command.
- .TP
- fIpathNamefR fBcoords fItagOrId fR?fIx0 y0 ...fR?
- .TP
- fIpathNamefR fBcoords fItagOrId fR?fIcoordListfR?
- Query or modify the coordinates that define an item.
- If no coordinates are specified, this command returns a list
- whose elements are the coordinates of the item named by
- fItagOrIdfR.
- If coordinates are specified, then they replace the current
- coordinates for the named item.
- If fItagOrIdfR refers to multiple items, then
- the first one in the display list is used.
- .TP
- fIpathName fBcreate fItype x y fR?fIx y ...fR? ?fIoption value ...fR?
- .TP
- fIpathName fBcreate fItype coordList fR?fIoption value ...fR?
- Create a new item in fIpathNamefR of type fItypefR.
- The exact format of the arguments after fBtypefR depends
- on fBtypefR, but usually they consist of the coordinates for
- one or more points, followed by specifications for zero or
- more item options.
- See the subsections on individual item types below for more
- on the syntax of this command.
- This command returns the id for the new item.
- .TP
- fIpathName fBdchars fItagOrId first fR?fIlastfR?
- For each item given by fItagOrIdfR, delete the characters, or coordinates,
- in the range given by fIfirstfR and fIlastfR, inclusive.
- If some of the items given by fItagOrIdfR don't support
- indexing operations then they ignore dchars.
- Text items interpret fIfirstfR and fIlastfR as indices to a character,
- line and polygon items interpret them indices to a coordinate (an x,y pair).
- Indices are described in INDICES above.
- If fIlastfR is omitted, it defaults to fIfirstfR.
- This command returns an empty string.
- .TP
- fIpathName fBdelete fR?fItagOrId tagOrId ...fR?
- Delete each of the items given by each fItagOrIdfR, and return
- an empty string.
- .TP
- fIpathName fBdtag fItagOrId fR?fItagToDeletefR?
- For each of the items given by fItagOrIdfR, delete the
- tag given by fItagToDeletefR from the list of those
- associated with the item.
- If an item doesn't have the tag fItagToDeletefR then
- the item is unaffected by the command.
- If fItagToDeletefR is omitted then it defaults to fItagOrIdfR.
- This command returns an empty string.
- .TP
- fIpathName fBfind fIsearchCommand fR?fIarg arg ...fR?
- This command returns a list consisting of all the items that
- meet the constraints specified by fIsearchCommandfR and
- fIargfR's.
- fISearchCommandfR and fIargsfR have any of the forms
- accepted by the fBaddtagfR command.
- The items are returned in stacking order, with the lowest item first.
- .TP
- fIpathName fBfocus fR?fItagOrIdfR?
- Set the keyboard focus for the canvas widget to the item given by
- fItagOrIdfR.
- If fItagOrIdfR refers to several items, then the focus is set
- to the first such item in the display list that supports the
- insertion cursor.
- If fItagOrIdfR doesn't refer to any items, or if none of them
- support the insertion cursor, then the focus isn't changed.
- If fItagOrIdfR is an empty
- string, then the focus item is reset so that no item has the focus.
- If fItagOrIdfR is not specified then the command returns the
- id for the item that currently has the focus, or an empty string
- if no item has the focus.
- .RS
- .PP
- Once the focus has been set to an item, the item will display
- the insertion cursor and all keyboard events will be directed
- to that item.
- The focus item within a canvas and the focus window on the
- screen (set with the fBfocusfR command) are totally independent:
- a given item doesn't actually have the input focus unless (a)
- its canvas is the focus window and (b) the item is the focus item
- within the canvas.
- In most cases it is advisable to follow the fBfocusfR widget
- command with the fBfocusfR command to set the focus window to
- the canvas (if it wasn't there already).
- .RE
- .TP
- fIpathName fBgettagsfR fItagOrIdfR
- Return a list whose elements are the tags associated with the
- item given by fItagOrIdfR.
- If fItagOrIdfR refers to more than one item, then the tags
- are returned from the first such item in the display list.
- If fItagOrIdfR doesn't refer to any items, or if the item
- contains no tags, then an empty string is returned.
- .TP
- fIpathName fBicursor fItagOrId indexfR
- Set the position of the insertion cursor for the item(s) given by fItagOrIdfR
- to just before the character whose position is given by fIindexfR.
- If some or all of the items given by fItagOrIdfR don't support
- an insertion cursor then this command has no effect on them.
- See INDICES above for a description of the
- legal forms for fIindexfR.
- Note: the insertion cursor is only displayed in an item if
- that item currently has the keyboard focus (see the widget
- command fBfocusfR, below), but the cursor position may
- be set even when the item doesn't have the focus.
- This command returns an empty string.
- .TP
- fIpathName fBindex fItagOrId indexfR
- This command returns a decimal string giving the numerical index
- within fItagOrIdfR corresponding to fIindexfR.
- fIIndexfR gives a textual description of the desired position
- as described in INDICES above.
- Text items interpret fIindexfR as an index to a character,
- line and polygon items interpret it as an index to a coordinate (an x,y pair).
- The return value is guaranteed to lie between 0 and the number
- of characters, or coordinates, within the item, inclusive.
- If fItagOrIdfR refers to multiple items, then the index
- is processed in the first of these items that supports indexing
- operations (in display list order).
- .TP
- fIpathName fBinsert fItagOrId beforeThis stringfR
- For each of the items given by fItagOrIdfR, if the item supports
- text or coordinate, insertion then fIstringfR is inserted into the item's
- text just before the character, or coordinate, whose index is fIbeforeThisfR.
- Text items interpret fIbeforeThisfR as an index to a character,
- line and polygon items interpret it as an index to a coordinate (an x,y pair).
- For lines and polygons the fIstringfR must be a valid coordinate
- sequence.
- See INDICES above for information about the forms allowed
- for fIbeforeThisfR.
- This command returns an empty string.
- .TP
- fIpathName fBitemcgetfR fItagOrIdfR fIoptionfR
- Returns the current value of the configuration option for the
- item given by fItagOrIdfR whose name is fIoptionfR.
- This command is similar to the fBcgetfR widget command except that
- it applies to a particular item rather than the widget as a whole.
- fIOptionfR may have any of the values accepted by the fBcreatefR
- widget command when the item was created.
- If fItagOrIdfR is a tag that refers to more than one item,
- the first (lowest) such item is used.
- .TP
- fIpathName fBitemconfigure fItagOrIdfR ?fIoptionfR? ?fIvaluefR? ?fIoption value ...fR?
- This command is similar to the fBconfigurefR widget command except
- that it modifies item-specific options for the items given by
- fItagOrIdfR instead of modifying options for the overall
- canvas widget.
- If no fIoptionfR is specified, returns a list describing all of
- the available options for the first item given by fItagOrIdfR
- (see fBTk_ConfigureInfofR for
- information on the format of this list). If fIoptionfR is specified
- with no fIvaluefR, then the command returns a list describing the
- one named option (this list will be identical to the corresponding
- sublist of the value returned if no fIoptionfR is specified). If
- one or more fIoption-valuefR pairs are specified, then the command
- modifies the given widget option(s) to have the given value(s) in
- each of the items given by fItagOrIdfR; in
- this case the command returns an empty string.
- The fIoptionfRs and fIvaluefRs are the same as those permissible
- in the fBcreatefR widget command when the item(s) were created;
- see the sections describing individual item types below for details
- on the legal options.
- .TP
- fIpathName fBlower fItagOrId fR?fIbelowThisfR?
- Move all of the items given by fItagOrIdfR to a new position
- in the display list just before the item given by fIbelowThisfR.
- If fItagOrIdfR refers to more than one item then all are moved
- but the relative order of the moved items will not be changed.
- fIBelowThisfR is a tag or id; if it refers to more than one
- item then the first (lowest) of these items in the display list is used
- as the destination location for the moved items.
- Note: this command has no effect on window items. Window items always
- obscure other item types, and the stacking order of window items is
- determined by the fBraisefR and fBlowerfR commands, not the
- fBraisefR and fBlowerfR widget commands for canvases.
- This command returns an empty string.
- .TP
- fIpathName fBmove fItagOrId xAmount yAmountfR
- Move each of the items given by fItagOrIdfR in the canvas coordinate
- space by adding fIxAmountfR to the x-coordinate of each point
- associated with the item and fIyAmountfR to the y-coordinate of
- each point associated with the item.
- This command returns an empty string.
- .TP
- fIpathName fBpostscript fR?fIoption value option value ...fR?
- Generate a Postscript representation for part or all of the canvas.
- If the fB-filefR option is specified then the Postscript is written
- to a file and an empty string is returned; otherwise the Postscript
- is returned as the result of the command.
- If the interpreter that owns the canvas is marked as safe, the operation
- will fail because safe interpreters are not allowed to write files.
- If the fB-channelfR option is specified, the argument denotes the name
- of a channel already opened for writing. The Postscript is written to
- that channel, and the channel is left open for further writing at the end
- of the operation.
- The Postscript is created in Encapsulated Postscript form using
- version 3.0 of the Document Structuring Conventions.
- Note: by default Postscript is only generated for information that
- appears in the canvas's window on the screen. If the canvas is
- freshly created it may still have its initial size of 1x1 pixel
- so nothing will appear in the Postscript. To get around this problem
- either invoke the "update" command to wait for the canvas window
- to reach its final size, or else use the fB-widthfR and fB-heightfR
- options to specify the area of the canvas to print.
- The fIoptionfR-fIvaluefR argument pairs provide additional
- information to control the generation of Postscript. The following
- options are supported:
- .RS
- .TP
- fB-colormap fIvarNamefR
- fIVarNamefR must be the name of an array variable
- that specifies a color mapping to use in the Postscript.
- Each element of fIvarNamefR must consist of Postscript
- code to set a particular color value (e.g. ``fB1.0 1.0 0.0 setrgbcolorfR'').
- When outputting color information in the Postscript, Tk checks
- to see if there is an element of fIvarNamefR with the same
- name as the color.
- If so, Tk uses the value of the element as the Postscript command
- to set the color.
- If this option hasn't been specified, or if there isn't an entry
- in fIvarNamefR for a given color, then Tk uses the red, green,
- and blue intensities from the X color.
- .TP
- fB-colormode fImodefR
- Specifies how to output color information. fIModefR must be either
- fBcolorfR (for full color output), fBgrayfR (convert all colors
- to their gray-scale equivalents) or fBmonofR (convert all colors
- to black or white).
- .TP
- fB-file fIfileNamefR
- Specifies the name of the file in which to write the Postscript.
- If this option isn't specified then the Postscript is returned as the
- result of the command instead of being written to a file.
- .TP
- fB-fontmap fIvarNamefR
- fIVarNamefR must be the name of an array variable
- that specifies a font mapping to use in the Postscript.
- Each element of fIvarNamefR must consist of a Tcl list with
- two elements, which are the name and point size of a Postscript font.
- When outputting Postscript commands for a particular font, Tk
- checks to see if fIvarNamefR contains an element with the same
- name as the font.
- If there is such an element, then the font information contained in
- that element is used in the Postscript.
- Otherwise Tk attempts to guess what Postscript font to use.
- Tk's guesses generally only work for well-known fonts such as
- Times and Helvetica and Courier, and only if the X font name does not
- omit any dashes up through the point size.
- For example, fB-*-Courier-Bold-R-Normal--*-120-*fR will work but
- fB*Courier-Bold-R-Normal*120*fR will not; Tk needs the dashes to
- parse the font name).
- .TP
- fB-height fIsizefR
- Specifies the height of the area of the canvas to print.
- Defaults to the height of the canvas window.
- .TP
- fB-pageanchor fIanchorfR
- Specifies which point of the printed area of the canvas should appear over
- the positioning point on the page (which is given by the fB-pagexfR
- and fB-pageyfR options).
- For example, fB-pageanchor nfR means that the top center of the
- area of the canvas being printed (as it appears in the canvas window)
- should be over the positioning point. Defaults to fBcenterfR.
- .TP
- fB-pageheight fIsizefR
- Specifies that the Postscript should be scaled in both x and y so
- that the printed area is fIsizefR high on the Postscript page.
- fISizefR consists of a floating-point number followed by
- fBcfR for centimeters, fBifR for inches, fBmfR for millimeters,
- or fBpfR or nothing for printer's points (1/72 inch).
- Defaults to the height of the printed area on the screen.
- If both fB-pageheightfR and fB-pagewidthfR are specified then
- the scale factor from fB-pagewidthfR is used (non-uniform scaling
- is not implemented).
- .TP
- fB-pagewidth fIsizefR
- Specifies that the Postscript should be scaled in both x and y so
- that the printed area is fIsizefR wide on the Postscript page.
- fISizefR has the same form as for fB-pageheightfR.
- Defaults to the width of the printed area on the screen.
- If both fB-pageheightfR and fB-pagewidthfR are specified then
- the scale factor from fB-pagewidthfR is used (non-uniform scaling
- is not implemented).
- .TP
- fB-pagex fIpositionfR
- fIPositionfR gives the x-coordinate of the positioning point on
- the Postscript page, using any of the forms allowed for fB-pageheightfR.
- Used in conjunction with the fB-pageyfR and fB-pageanchorfR options
- to determine where the printed area appears on the Postscript page.
- Defaults to the center of the page.
- .TP
- fB-pagey fIpositionfR
- fIPositionfR gives the y-coordinate of the positioning point on
- the Postscript page, using any of the forms allowed for fB-pageheightfR.
- Used in conjunction with the fB-pagexfR and fB-pageanchorfR options
- to determine where the printed area appears on the Postscript page.
- Defaults to the center of the page.
- .TP
- fB-rotate fIbooleanfR
- fIBooleanfR specifies whether the printed area is to be rotated 90
- degrees.
- In non-rotated output the x-axis of the printed area runs along
- the short dimension of the page (``portrait'' orientation);
- in rotated output the x-axis runs along the long dimension of the
- page (``landscape'' orientation).
- Defaults to non-rotated.
- .TP
- fB-width fIsizefR
- Specifies the width of the area of the canvas to print.
- Defaults to the width of the canvas window.
- .TP
- fB-x fIpositionfR
- Specifies the x-coordinate of the left edge of the area of the
- canvas that is to be printed, in canvas coordinates, not window
- coordinates.
- Defaults to the coordinate of the left edge of the window.
- .TP
- fB-y fIpositionfR
- Specifies the y-coordinate of the top edge of the area of the
- canvas that is to be printed, in canvas coordinates, not window
- coordinates.
- Defaults to the coordinate of the top edge of the window.
- .RE
- .TP
- fIpathName fBraise fItagOrId fR?fIaboveThisfR?
- Move all of the items given by fItagOrIdfR to a new position
- in the display list just after the item given by fIaboveThisfR.
- If fItagOrIdfR refers to more than one item then all are moved
- but the relative order of the moved items will not be changed.
- fIAboveThisfR is a tag or id; if it refers to more than one
- item then the last (topmost) of these items in the display list is used
- as the destination location for the moved items.
- Note: this command has no effect on window items. Window items always
- obscure other item types, and the stacking order of window items is
- determined by the fBraisefR and fBlowerfR commands, not the
- fBraisefR and fBlowerfR widget commands for canvases.
- This command returns an empty string.
- .TP
- fIpathName fBscale fItagOrId xOrigin yOrigin xScale yScalefR
- Rescale all of the items given by fItagOrIdfR in canvas coordinate
- space.
- fIXOriginfR and fIyOriginfR identify the origin for the scaling
- operation and fIxScalefR and fIyScalefR identify the scale
- factors for x- and y-coordinates, respectively (a scale factor of
- 1.0 implies no change to that coordinate).
- For each of the points defining each item, the x-coordinate is
- adjusted to change the distance from fIxOriginfR by a factor
- of fIxScalefR.
- Similarly, each y-coordinate is adjusted to change the distance
- from fIyOriginfR by a factor of fIyScalefR.
- This command returns an empty string.
- .TP
- fIpathName fBscanfR fIoption argsfR
- This command is used to implement scanning on canvases. It has
- two forms, depending on fIoptionfR:
- .RS
- .TP
- fIpathName fBscan mark fIx yfR
- Records fIxfR and fIyfR and the canvas's current view; used
- in conjunction with later fBscan dragtofR commands.
- Typically this command is associated with a mouse button press in
- the widget and fIxfR and fIyfR are the coordinates of the
- mouse. It returns an empty string.
- .TP
- fIpathName fBscan dragto fIx y ?gain?fR.
- This command computes the difference between its fIxfR and fIyfR
- arguments (which are typically mouse coordinates) and the fIxfR and
- fIyfR arguments to the last fBscan markfR command for the widget.
- It then adjusts the view by fIgainfR times the
- difference in coordinates, where fIgainfR defaults to 10.
- This command is typically associated
- with mouse motion events in the widget, to produce the effect of
- dragging the canvas at high speed through its window. The return
- value is an empty string.
- .RE
- .TP
- fIpathName fBselect fIoptionfR ?fItagOrId argfR?
- Manipulates the selection in one of several ways, depending on
- fIoptionfR.
- The command may take any of the forms described below.
- In all of the descriptions below, fItagOrIdfR must refer to
- an item that supports indexing and selection; if it refers to
- multiple items then the first of
- these that supports indexing and the selection is used.
- fIIndexfR gives a textual description of a position
- within fItagOrIdfR, as described in INDICES above.
- .RS
- .TP
- fIpathName fBselect adjust fItagOrId indexfR
- Locate the end of the selection in fItagOrIdfR nearest
- to the character given by fIindexfR, and adjust that
- end of the selection to be at fIindexfR (i.e. including
- but not going beyond fIindexfR).
- The other end of the selection is made the anchor point
- for future fBselect tofR commands.
- If the selection isn't currently in fItagOrIdfR then
- this command behaves the same as the fBselect tofR widget
- command.
- Returns an empty string.
- .TP
- fIpathName fBselect clearfR
- Clear the selection if it is in this widget.
- If the selection isn't in this widget then the command
- has no effect.
- Returns an empty string.
- .TP
- fIpathName fBselect from fItagOrId indexfR
- Set the selection anchor point for the widget to be just
- before the character
- given by fIindexfR in the item given by fItagOrIdfR.
- This command doesn't change the selection; it just sets
- the fixed end of the selection for future fBselect tofR
- commands.
- Returns an empty string.
- .TP
- fIpathName fBselect itemfR
- Returns the id of the selected item, if the selection is in an
- item in this canvas.
- If the selection is not in this canvas then an empty string
- is returned.
- .TP
- fIpathName fBselect to fItagOrId indexfR
- Set the selection to consist of those characters of fItagOrIdfR
- between the selection anchor point and
- fIindexfR.
- The new selection will include the character given by fIindexfR;
- it will include the character given by the anchor point only if
- fIindexfR is greater than or equal to the anchor point.
- The anchor point is determined by the most recent fBselect adjustfR
- or fBselect fromfR command for this widget.
- If the selection anchor point for the widget isn't currently in
- fItagOrIdfR, then it is set to the same character given
- by fIindexfR.
- Returns an empty string.
- .RE
- .TP
- fIpathName fBtypefI tagOrIdfR
- Returns the type of the item given by fItagOrIdfR, such as
- fBrectanglefR or fBtextfR.
- If fItagOrIdfR refers to more than one item, then the type
- of the first item in the display list is returned.
- If fItagOrIdfR doesn't refer to any items at all then
- an empty string is returned.
- .TP
- fIpathName fBxview fR?fIargsfR?
- This command is used to query and change the horizontal position of the
- information displayed in the canvas's window.
- It can take any of the following forms:
- .RS
- .TP
- fIpathName fBxviewfR
- Returns a list containing two elements.
- Each element is a real fraction between 0 and 1; together they describe
- the horizontal span that is visible in the window.
- For example, if the first element is .2 and the second element is .6,
- 20% of the canvas's area (as defined by the fB-scrollregionfR option)
- is off-screen to the left, the middle 40% is visible
- in the window, and 40% of the canvas is off-screen to the right.
- These are the same values passed to scrollbars via the fB-xscrollcommandfR
- option.
- .TP
- fIpathName fBxview movetofI fractionfR
- Adjusts the view in the window so that fIfractionfR of the
- total width of the canvas is off-screen to the left.
- fIFractionfR must be a fraction between 0 and 1.
- .TP
- fIpathName fBxview scroll fInumber whatfR
- This command shifts the view in the window left or right according to
- fInumberfR and fIwhatfR.
- fINumberfR must be an integer.
- fIWhatfR must be either fBunitsfR or fBpagesfR or an abbreviation
- of one of these.
- If fIwhatfR is fBunitsfR, the view adjusts left or right in units
- of the fBxScrollIncrementfR option, if it is greater than zero,
- or in units of one-tenth the window's width otherwise.
- If fIwhat is fBpagesfR then the view
- adjusts in units of nine-tenths the window's width.
- If fInumberfR is negative then information farther to the left
- becomes visible; if it is positive then information farther to the right
- becomes visible.
- .RE
- .TP
- fIpathName fByview fI?argsfR?
- This command is used to query and change the vertical position of the
- information displayed in the canvas's window.
- It can take any of the following forms:
- .RS
- .TP
- fIpathName fByviewfR
- Returns a list containing two elements.
- Each element is a real fraction between 0 and 1; together they describe
- the vertical span that is visible in the window.
- For example, if the first element is .6 and the second element is 1.0,
- the lowest 40% of the canvas's area (as defined by the fB-scrollregionfR
- option) is visible in the window.
- These are the same values passed to scrollbars via the fB-yscrollcommandfR
- option.
- .TP
- fIpathName fByview movetofI fractionfR
- Adjusts the view in the window so that fIfractionfR of the canvas's
- area is off-screen to the top.
- fIFractionfR is a fraction between 0 and 1.
- .TP
- fIpathName fByview scroll fInumber whatfR
- This command adjusts the view in the window up or down according to
- fInumberfR and fIwhatfR.
- fINumberfR must be an integer.
- fIWhatfR must be either fBunitsfR or fBpagesfR.
- If fIwhatfR is fBunitsfR, the view adjusts up or down in units
- of the fByScrollIncrementfR option, if it is greater than zero,
- or in units of one-tenth the window's height otherwise.
- If fIwhatfR is fBpagesfR then
- the view adjusts in units of nine-tenths the window's height.
- If fInumberfR is negative then higher information becomes
- visible; if it is positive then lower information
- becomes visible.
- .RE
- .SH "OVERVIEW OF ITEM TYPES"
- .PP
- The sections below describe the various types of items supported
- by canvas widgets. Each item type is characterized by two things:
- first, the form of the fBcreatefR command used to create
- instances of the type; and second, a set of configuration options
- for items of that type, which may be used in the
- fBcreatefR and fBitemconfigurefR widget commands.
- Most items don't support indexing or selection or the commands
- related to them, such as fBindexfR and fBinsertfR.
- Where items do support these facilities, it is noted explicitly
- in the descriptions below.
- At present, text, line and polygon items provide this support.
- For lines and polygons the indexing facility is used to manipulate
- the coordinates of the item.
- .SH "COMMON ITEM OPTIONS"
- .PP
- Many items share a common set of options. These options are
- explained here, and then referred to be each widget type for brevity.
- .PP
- .TP
- fB-dash fIpatternfR
- .TP
- fB-activedash fIpatternfR
- .TP
- fB-disableddash fIpatternfR
- This option specifies dash patterns for the normal, active
- state, and disabled state of an item.
- fIpatternfR may have any of the forms accepted by fBTk_GetDashfR.
- If the dash options are omitted then the default is a solid outline.
- See "DASH PATTERNS" for more information.
- .TP
- fB-dashoffset fIoffsetfR
- The starting fIoffsetfR in pixels into the pattern provided by the
- fB-dashfR option. fB-dashoffsetfR is ignored if there is no
- fB-dashfR pattern. The fIoffsetfR may have any of the forms described
- in the fBCOORDINATESfR section above.
- .TP
- fB-fill fIcolorfR
- .TP
- fB-activefill fIcolorfR
- .TP
- fB-disabledfill fIcolorfR
- Specifies the color to be used to fill item's area.
- in its normal, active, and disabled states,
- fIColorfR may have any of the forms accepted by fBTk_GetColorfR.
- If fIcolorfR is an empty string (the default),
- then the item will not be filled.
- For the line item, it specifies the color of the line drawn.
- For the text item, it specifies the foreground color of the text.
- .TP
- fB-outline fIcolorfR
- .TP
- fB-activeoutline fIcolorfR
- .TP
- fB-disabledoutline fIcolorfR
- This option specifies the color that should be used to draw the
- outline of the item in its normal, active and disabled states.
- fIColorfR may have any of the forms accepted by fBTk_GetColorfR.
- This option defaults to fBblackfR. If fIcolorfR is specified
- as an empty string then no outline is drawn for the item.
- .TP
- fB-offset fIoffsetfR
- Specifies the offset of stipples. The offset value can be of the form
- fBx,yfR or fBsidefR, where side can be fBnfR, fBnefR, fBefR,
- fBsefR, fBsfR, fBswfR, fBwfR, fBnwfR, or fBcenterfR. In the
- first case the origin is the origin of the toplevel of the current window.
- For the canvas itself and canvas objects the origin is the canvas origin,
- but putting fB#fR in front of the coordinate pair indicates using the
- toplevel origin instead. For canvas objects, the fB-offsetfR option is
- used for stippling as well. For the line and polygon canvas items you can
- also specify an index as argument, which connects the stipple origin to one
- of the coordinate points of the line/polygon.
- .TP
- fB-outlinestipple fIbitmapfR
- .TP
- fB-activeoutlinestipple fIbitmapfR
- .TP
- fB-disabledoutlinestipple fIbitmapfR
- This option specifies stipple patterns that should be used to draw the
- outline of the item in its normal, active and disabled states.
- Indicates that the outline for the item should be drawn with a stipple pattern;
- fIbitmapfR specifies the stipple pattern to use, in any of the
- forms accepted by fBTk_GetBitmapfR.
- If the fB-outlinefR option hasn't been specified then this option
- has no effect.
- If fIbitmapfR is an empty string (the default), then the outline is drawn
- in a solid fashion.
- fINote that stipples are not well supported on platforms that do not
- use X11 as their drawing API.fR
- .TP
- fB-stipple fIbitmapfR
- .TP
- fB-activestipple fIbitmapfR
- .TP
- fB-disabledstipple fIbitmapfR
- This option specifies stipple patterns that should be used to fill
- the item in its normal, active and disabled states.
- fIbitmapfR specifies the stipple pattern to use, in any of the
- forms accepted by fBTk_GetBitmapfR.
- If the fB-fillfR option hasn't been specified then this option
- has no effect.
- If fIbitmapfR is an empty string (the default), then filling is done
- in a solid fashion.
- For the text item, it affects the actual text.
- fINote that stipples are not well supported on platforms that do not
- use X11 as their drawing API.fR
- .TP
- fB-state fIstatefR
- This allows an item to override the canvas widget's global fIstatefR
- option. It takes the same values:
- fInormalfR, fIdisabledfR or fIhiddenfR.
- .TP
- fB-tags fItagListfR
- Specifies a set of tags to apply to the item.
- fITagListfR consists of a list of tag names, which replace any
- existing tags for the item. fITagListfR may be an empty list.
- .TP
- fB-width fIoutlineWidthfR
- .TP
- fB-activewidth fIoutlineWidthfR
- .TP
- fB-disabledwidth fIoutlineWidthfR
- Specifies the width of the outline to be drawn around
- the item's region, in its normal, active and disabled states.
- fIoutlineWidthfR may be in any of the forms described in the
- fBCOORDINATESfR section above.
- If the fB-outlinefR option has been specified as an empty string then
- this option has no effect. This option defaults to 1.0.
- For arcs, wide outlines will be drawn centered on the edges of the
- arc's region.
- .SH "ARC ITEMS"
- .PP
- Items of type fBarcfR appear on the display as arc-shaped regions.
- An arc is a section of an oval delimited by two angles (specified
- by the fB-startfR and fB-extentfR options) and displayed in
- one of several ways (specified by the fB-stylefR option).
- Arcs are created with widget commands of the following form:
- .CS
- fIpathName fBcreate arc fIx1 y1 x2 y2 fR?fIoption value option value ...fR?
- fIpathName fBcreate arc fIcoordListfR ?fIoption value option value ...fR?
- .CE
- The arguments fIx1fR, fIy1fR, fIx2fR, and fIy2fR or fIcoordListfR give
- the coordinates of two diagonally opposite corners of a
- rectangular region enclosing the oval that defines the arc.
- After the coordinates there may be any number of fIoptionfR-fIvaluefR
- pairs, each of which sets one of the configuration options
- for the item. These same fIoptionfR-fIvaluefR pairs may be
- used in fBitemconfigurefR widget commands to change the item's
- configuration.
- .br
- The following standard options are supported by arcs:
- .CS
- -dash
- -activedash
- -disableddash
- -dashoffset
- -fill
- -activefill
- -disabledfill
- -offset
- -outline
- -activeoutline
- -disabledoutline
- -outlinestipple
- -activeoutlinestipple
- -disabledoutlinestipple
- -stipple
- -activestipple
- -disabledstipple
- -state
- -tags
- -width
- -activewidth
- -disabledwidth
- .CE
- The following extra options are supported for arcs:
- .TP
- fB-extent fIdegreesfR
- Specifies the size of the angular range occupied by the arc.
- The arc's range extends for fIdegreesfR degrees counter-clockwise
- from the starting angle given by the fB-startfR option.
- fIDegreesfR may be negative.
- If it is greater than 360 or less than -360, then fIdegreesfR
- modulo 360 is used as the extent.
- .TP
- fB-start fIdegreesfR
- Specifies the beginning of the angular range occupied by the
- arc.
- fIDegreesfR is given in units of degrees measured counter-clockwise
- from the 3-o'clock position; it may be either positive or negative.
- .TP
- fB-style fItypefR
- Specifies how to draw the arc. If fItypefR is fBpieslicefR
- (the default) then the arc's region is defined by a section
- of the oval's perimeter plus two line segments, one between the center
- of the oval and each end of the perimeter section.
- If fItypefR is fBchordfR then the arc's region is defined
- by a section of the oval's perimeter plus a single line segment
- connecting the two end points of the perimeter section.
- If fItypefR is fBarcfR then the arc's region consists of
- a section of the perimeter alone.
- In this last case the fB-fillfR option is ignored.
- .SH "BITMAP ITEMS"
- .PP
- Items of type fBbitmapfR appear on the display as images with
- two colors, foreground and background.
- Bitmaps are created with widget commands of the following form:
- .CS
- fIpathName fBcreate bitmap fIx y fR?fIoption value option value ...fR?
- fIpathName fBcreate bitmap fIcoordListfR ?fIoption value option value ...fR?
- .CE
- The arguments fIxfR and fIyfR or fIcoordListfR specify the coordinates of a
- point used to position the bitmap on the display (see the fB-anchorfR
- option below for more information on how bitmaps are displayed).
- After the coordinates there may be any number of fIoptionfR-fIvaluefR
- pairs, each of which sets one of the configuration options
- for the item. These same fIoptionfR-fIvaluefR pairs may be
- used in fBitemconfigurefR widget commands to change the item's
- configuration.
- .br
- The following standard options are supported by bitmaps:
- .CS
- -state
- -tags
- .CE
- The following extra options are supported for bitmaps:
- .TP
- fB-anchor fIanchorPosfR
- fIAnchorPosfR tells how to position the bitmap relative to the
- positioning point for the item; it may have any of the forms
- accepted by fBTk_GetAnchorfR. For example, if fIanchorPosfR
- is fBcenterfR then the bitmap is centered on the point; if
- fIanchorPosfR is fBnfR then the bitmap will be drawn so that
- its top center point is at the positioning point.
- This option defaults to fBcenterfR.
- .TP
- fB-background fIcolorfR
- .TP
- fB-activebackground fIbitmapfR
- .TP
- fB-disabledbackground fIbitmapfR
- Specifies the color to use for each of the bitmap's '0' valued pixels
- in its normal, active and disabled states.
- fIColorfR may have any of the forms accepted by fBTk_GetColorfR.
- If this option isn't specified, or if it is specified as an empty
- string, then nothing is displayed where the bitmap pixels are 0; this
- produces a transparent effect.
- .TP
- fB-bitmap fIbitmapfR
- .TP
- fB-activebitmap fIbitmapfR
- .TP
- fB-disabledbitmap fIbitmapfR
- Specifies the bitmaps to display in the item in its normal, active and
- disabled states.
- fIBitmapfR may have any of the forms accepted by fBTk_GetBitmapfR.
- .TP
- fB-foreground fIcolorfR
- .TP
- fB-activeforeground fIbitmapfR
- .TP
- fB-disabledforeground fIbitmapfR
- Specifies the color to use for each of the bitmap's '1' valued pixels
- in its normal, active and disabled states.
- fIColorfR may have any of the forms accepted by fBTk_GetColorfR and
- defaults to fBblackfR.
- .SH "IMAGE ITEMS"
- .PP
- Items of type fBimagefR are used to display images on a
- canvas.
- Images are created with widget commands of the following form:
- .CS
- fIpathName fBcreate image fIx y fR?fIoption value option value ...fR?
- fIpathName fBcreate image fIcoordListfR ?fIoption value option value ...fR?
- .CE
- The arguments fIxfR and fIyfR or fIcoordListfR specify the coordinates of a
- point used to position the image on the display (see the fB-anchorfR
- option below for more information).
- After the coordinates there may be any number of fIoptionfR-fIvaluefR
- pairs, each of which sets one of the configuration options
- for the item. These same fIoptionfR-fIvaluefR pairs may be
- used in fBitemconfigurefR widget commands to change the item's
- configuration.
- .br
- The following standard options are supported by images:
- .CS
- -state
- -tags
- .CE
- The following extra options are supported for images:
- .TP
- fB-anchor fIanchorPosfR
- fIAnchorPosfR tells how to position the image relative to the
- positioning point for the item; it may have any of the forms
- accepted by fBTk_GetAnchorfR. For example, if fIanchorPosfR
- is fBcenterfR then the image is centered on the point; if
- fIanchorPosfR is fBnfR then the image will be drawn so that
- its top center point is at the positioning point.
- This option defaults to fBcenterfR.
- .TP
- fB-image fInamefR
- .TP
- fB-activeimage fInamefR
- .TP
- fB-disabledimage fInamefR
- Specifies the name of the images to display in the item in is normal,
- active and disabled states.
- This image must have been created previously with the
- fBimage createfR command.
- .SH "LINE ITEMS"
- .PP
- Items of type fBlinefR appear on the display as one or more connected
- line segments or curves.
- Line items support coordinate indexing operations using the canvas
- widget commands: fBdchars, index, insert.fR
- Lines are created with widget commands of the following form:
- .CS
- fIpathName fBcreate line fIx1 y1... xn yn fR?fIoption value option value ...fR?
- fIpathName fBcreate line fIcoordListfR ?fIoption value option value ...fR?
- .CE
- The arguments fIx1fR through fIynfR or fIcoordListfR give
- the coordinates for a series of two or more points that describe
- a series of connected line segments.
- After the coordinates there may be any number of fIoptionfR-fIvaluefR
- pairs, each of which sets one of the configuration options
- for the item. These same fIoptionfR-fIvaluefR pairs may be
- used in fBitemconfigurefR widget commands to change the item's
- configuration.
- .br
- The following standard options are supported by lines:
- .CS
- -dash
- -activedash
- -disableddash
- -dashoffset
- -fill
- -activefill
- -disabledfill
- -stipple
- -activestipple
- -disabledstipple
- -state
- -tags
- -width
- -activewidth
- -disabledwidth
- .CE
- The following extra options are supported for lines:
- .TP
- fB-arrow fIwherefR
- Indicates whether or not arrowheads are to be drawn at one or both
- ends of the line.
- fIWherefR must have one of the values fBnonefR (for no arrowheads),
- fBfirstfR (for an arrowhead at the first point of the line),
- fBlastfR (for an arrowhead at the last point of the line), or
- fBbothfR (for arrowheads at both ends).
- This option defaults to fBnonefR.
- .TP
- fB-arrowshape fIshapefR
- This option indicates how to draw arrowheads.
- The fIshapefR argument must be a list with three elements, each
- specifying a distance in any of the forms described in
- the fBCOORDINATESfR section above.
- The first element of the list gives the distance along the line
- from the neck of the arrowhead to its tip.
- The second element gives the distance along the line from the
- trailing points of the arrowhead to the tip, and the third
- element gives the distance from the outside edge of the line to the
- trailing points.
- If this option isn't specified then Tk picks a ``reasonable'' shape.
- .TP
- fB-capstyle fIstylefR
- Specifies the ways in which caps are to be drawn at the endpoints
- of the line.
- fIStylefR may have any of the forms accepted by fBTk_GetCapStylefR
- (fBbuttfR, fBprojectingfR, or fBroundfR).
- If this option isn't specified then it defaults to fBbuttfR.
- Where arrowheads are drawn the cap style is ignored.
- .TP
- fB-joinstyle fIstylefR
- Specifies the ways in which joints are to be drawn at the vertices
- of the line.
- fIStylefR may have any of the forms accepted by fBTk_GetCapStylefR
- (fBbevelfR, fBmiterfR, or fBroundfR).
- If this option isn't specified then it defaults to fBmiterfR.
- If the line only contains two points then this option is
- irrelevant.
- .TP
- fB-smooth fIsmoothMethodfR
- fIsmoothMethodfR must have one of the forms accepted by
- fBTcl_GetBooleanfR or a line smoothing method. Only fBbezierfR is
- supported in the core, but more can be added at runtime. If a boolean
- false value or empty string is given, no smoothing is applied. A boolean
- truth value assume fBbezierfR smoothing.
- It indicates whether or not the line should be drawn as a curve.
- If so, the line is rendered as a set of parabolic splines: one spline
- is drawn for the first and second line segments, one for the second
- and third, and so on. Straight-line segments can be generated within
- a curve by duplicating the end-points of the desired line segment.
- .TP
- fB-splinesteps fInumberfR
- Specifies the degree of smoothness desired for curves: each spline
- will be approximated with fInumberfR line segments. This
- option is ignored unless the fB-smoothfR option is true.
- .SH "OVAL ITEMS"
- .PP
- Items of type fBovalfR appear as circular or oval regions on
- the display. Each oval may have an outline, a fill, or
- both. Ovals are created with widget commands of the
- following form:
- .CS
- fIpathName fBcreate oval fIx1 y1 x2 y2 fR?fIoption value option value ...fR?
- fIpathName fBcreate oval fIcoordListfR ?fIoption value option value ...fR?
- .CE
- The arguments fIx1fR, fIy1fR, fIx2fR, and fIy2fR or fIcoordListfR give
- the coordinates of two diagonally opposite corners of a
- rectangular region enclosing the oval.
- The oval will include the top and left edges of the rectangle
- not the lower or right edges.
- If the region is square then the resulting oval is circular;
- otherwise it is elongated in shape.
- After the coordinates there may be any number of fIoptionfR-fIvaluefR
- pairs, each of which sets one of the configuration options
- for the item. These same fIoptionfR-fIvaluefR pairs may be
- used in fBitemconfigurefR widget commands to change the item's
- configuration.
- .br
- The following standard options are supported by ovals:
- .CS
- -dash
- -activedash
- -disableddash
- -dashoffset
- -fill
- -activefill
- -disabledfill
- -offset
- -outline
- -activeoutline
- -disabledoutline
- -outlinestipple
- -activeoutlinestipple
- -disabledoutlinestipple
- -stipple
- -activestipple
- -disabledstipple
- -state
- -tags
- -width
- -activewidth
- -disabledwidth
- .CE
- .SH "POLYGON ITEMS"
- .PP
- Items of type fBpolygonfR appear as polygonal or curved filled regions
- on the display.
- Polygon items support coordinate indexing operations using the canvas
- widget commands: fBdchars, index, insert.fR
- Polygons are created with widget commands of the following form:
- .CS
- fIpathName fBcreate polygon fIx1 y1 ... xn yn fR?fIoption value option value ...fR?
- fIpathName fBcreate polygon fIcoordListfR ?fIoption value option value ...fR?
- .CE
- The arguments fIx1fR through fIynfR or fIcoordListfR specify the coordinates for
- three or more points that define a polygon.
- The first point should not be repeated as the last to
- close the shape; Tk will automatically close the periphery between
- the first and last points.
- After the coordinates there may be any number of fIoptionfR-fIvaluefR
- pairs, each of which sets one of the configuration options
- for the item. These same fIoptionfR-fIvaluefR pairs may be
- used in fBitemconfigurefR widget commands to change the item's
- configuration.
- .br
- The following standard options are supported by polygons:
- .CS
- -dash
- -activedash
- -disableddash
- -dashoffset
- -fill
- -activefill
- -disabledfill
- -offset
- -outline
- -activeoutline
- -disabledoutline
- -outlinestipple
- -activeoutlinestipple
- -disabledoutlinestipple
- -stipple
- -activestipple
- -disabledstipple
- -state
- -tags
- -width
- -activewidth
- -disabledwidth
- .CE
- The following extra options are supported for polygons:
- .TP
- fB-joinstyle fIstylefR
- Specifies the ways in which joints are to be drawn at the vertices
- of the outline.
- fIStylefR may have any of the forms accepted by fBTk_GetCapStylefR
- (fBbevelfR, fBmiterfR, or fBroundfR).
- If this option isn't specified then it defaults to fBmiterfR.
- .TP
- fB-smooth fIbooleanfR
- fIBooleanfR must have one of the forms accepted by fBTcl_GetBooleanfR.
- It indicates whether or not the polygon should be drawn with a
- curved perimeter.
- If so, the outline of the polygon becomes a set of parabolic splines,
- one spline for the first and second line segments, one for the second
- and third, and so on. Straight-line segments can be generated in a
- smoothed polygon by duplicating the end-points of the desired line segment.
- .TP
- fB-splinesteps fInumberfR
- Specifies the degree of smoothness desired for curves: each spline
- will be approximated with fInumberfR line segments. This
- option is ignored unless the fB-smoothfR option is true.
- .PP
- Polygon items are different from other items such as rectangles, ovals
- and arcs in that interior points are considered to be ``inside'' a
- polygon (e.g. for purposes of the fBfind closestfR and
- fBfind overlappingfR widget commands) even if it is not filled.
- For most other item types, an
- interior point is considered to be inside the item only if the item
- is filled or if it has neither a fill nor an outline. If you would
- like an unfilled polygon whose interior points are not considered
- to be inside the polygon, use a line item instead.
- .SH "RECTANGLE ITEMS"
- .PP
- Items of type fBrectanglefR appear as rectangular regions on
- the display. Each rectangle may have an outline, a fill, or
- both. Rectangles are created with widget commands of the
- following form:
- .CS
- fIpathName fBcreate rectangle fIx1 y1 x2 y2 fR?fIoption value option value ...fR?
- fIpathName fBcreate rectangle fIcoordListfR ?fIoption value option value ...fR?
- .CE
- The arguments fIx1fR, fIy1fR, fIx2fR, and fIy2fR or fIcoordListfR give
- the coordinates of two diagonally opposite corners of the rectangle
- (the rectangle will include its upper and left edges but not
- its lower or right edges).
- After the coordinates there may be any number of fIoptionfR-fIvaluefR
- pairs, each of which sets one of the configuration options
- for the item. These same fIoptionfR-fIvaluefR pairs may be
- used in fBitemconfigurefR widget commands to change the item's
- configuration.
- .br
- The following standard options are supported by rectangles:
- .CS
- -dash
- -activedash
- -disableddash
- -dashoffset
- -fill
- -activefill
- -disabledfill
- -offset
- -outline
- -activeoutline
- -disabledoutline
- -outlinestipple
- -activeoutlinestipple
- -disabledoutlinestipple
- -stipple
- -activestipple
- -disabledstipple
- -state
- -tags
- -width
- -activewidth
- -disabledwidth
- .CE
- .SH "TEXT ITEMS"
- .PP
- A text item displays a string of characters on the screen in one
- or more lines.
- Text items support indexing and selection, along with the
- following text-related canvas widget commands: fBdcharsfR,
- fBfocusfR, fBicursorfR, fBindexfR, fBinsertfR,
- fBselectfR.
- Text items are created with widget commands of the following
- form:
- .CS
- fIpathName fBcreate text fIx y fR?fIoption value option value ...fR?
- fIpathName fBcreate text fIcoordListfR ?fIoption value option value ...fR?
- .CE
- The arguments fIxfR and fIyfR or fIcoordListfR specify the coordinates of a
- point used to position the text on the display (see the options
- below for more information on how text is displayed).
- After the coordinates there may be any number of fIoptionfR-fIvaluefR
- pairs, each of which sets one of the configuration options
- for the item. These same fIoptionfR-fIvaluefR pairs may be
- used in fBitemconfigurefR widget commands to change the item's
- configuration.
- .br
- The following standard options are supported by text items:
- .CS
- -fill
- -activefill
- -disabledfill
- -stipple
- -activestipple
- -disabledstipple
- -state
- -tags
- .CE
- The following extra options are supported for text items:
- .TP
- fB-anchor fIanchorPosfR
- fIAnchorPosfR tells how to position the text relative to the
- positioning point for the text; it may have any of the forms
- accepted by fBTk_GetAnchorfR. For example, if fIanchorPosfR
- is fBcenterfR then the text is centered on the point; if
- fIanchorPosfR is fBnfR then the text will be drawn such that
- the top center point of the rectangular region occupied by the
- text will be at the positioning point.
- This option defaults to fBcenterfR.
- .TP
- fB-font fIfontNamefR
- Specifies the font to use for the text item.
- fIFontNamefR may be any string acceptable to fBTk_GetFontfR.
- If this option isn't specified, it defaults to a system-dependent
- font.
- .TP
- fB-justify fIhowfR
- Specifies how to justify the text within its bounding region.
- fIHowfR must be one of the values fBleftfR, fBrightfR,
- or fBcenterfR.
- This option will only matter if the text is displayed as multiple
- lines.
- If the option is omitted, it defaults to fBleftfR.
- .TP
- fB-text fIstringfR
- fIStringfR specifies the characters to be displayed in the text item.
- Newline characters cause line breaks.
- The characters in the item may also be changed with the
- fBinsertfR and fBdeletefR widget commands.
- This option defaults to an empty string.
- .TP
- fB-width fIlineLengthfR
- Specifies a maximum line length for the text, in any of the forms
- described in the fBCOORDINATESfR section above.
- If this option is zero (the default) the text is broken into
- lines only at newline characters.
- However, if this option is non-zero then any line that would
- be longer than fIlineLengthfR is broken just before a space
- character to make the line shorter than fIlineLengthfR; the
- space character is treated as if it were a newline
- character.
- .SH "WINDOW ITEMS"
- .PP
- Items of type fBwindowfR cause a particular window to be displayed
- at a given position on the canvas.
- Window items are created with widget commands of the following form:
- .CS
- fIpathName fBcreate window fIx y fR?fIoption value option value ...fR?
- fIpathName fBcreate window fIcoordListfR ?fIoption value option value ...fR?
- .CE
- The arguments fIxfR and fIyfR or fIcoordListfR specify the coordinates of a
- point used to position the window on the display (see the fB-anchorfR
- option below for more information on how bitmaps are displayed).
- After the coordinates there may be any number of fIoptionfR-fIvaluefR
- pairs, each of which sets one of the configuration options
- for the item. These same fIoptionfR-fIvaluefR pairs may be
- used in fBitemconfigurefR widget commands to change the item's
- configuration.
- .br
- The following standard options are supported by window items:
- .CS
- -state
- -tags
- .CE
- The following extra options are supported for window items:
- .TP
- fB-anchor fIanchorPosfR
- fIAnchorPosfR tells how to position the window relative to the
- positioning point for the item; it may have any of the forms
- accepted by fBTk_GetAnchorfR. For example, if fIanchorPosfR
- is fBcenterfR then the window is centered on the point; if
- fIanchorPosfR is fBnfR then the window will be drawn so that
- its top center point is at the positioning point.
- This option defaults to fBcenterfR.
- .TP
- fB-height fIpixelsfR
- Specifies the height to assign to the item's window.
- fIPixelsfR may have any of the
- forms described in the fBCOORDINATESfR section above.
- If this option isn't specified, or if it is specified as an empty
- string, then the window is given whatever height it requests internally.
- .TP
- fB-width fIpixelsfR
- Specifies the width to assign to the item's window.
- fIPixelsfR may have any of the
- forms described in the fBCOORDINATESfR section above.
- If this option isn't specified, or if it is specified as an empty
- string, then the window is given whatever width it requests internally.
- .TP
- fB-window fIpathNamefR
- Specifies the window to associate with this item.
- The window specified by fIpathNamefR must either be a child of
- the canvas widget or a child of some ancestor of the canvas widget.
- fIPathNamefR may not refer to a top-level window.
- .PP
- Note: due to restrictions in the ways that windows are managed, it is not
- possible to draw other graphical items (such as lines and images) on top
- of window items. A window item always obscures any graphics that
- overlap it, regardless of their order in the display list.
- .SH "APPLICATION-DEFINED ITEM TYPES"
- .PP
- It is possible for individual applications to define new item
- types for canvas widgets using C code.
- See the documentation for fBTk_CreateItemTypefR.
- .SH BINDINGS
- .PP
- In the current implementation, new canvases are not given any
- default behavior: you'll have to execute explicit Tcl commands
- to give the canvas its behavior.
- .SH CREDITS
- .PP
- Tk's canvas widget is a blatant ripoff of ideas from Joel Bartlett's
- fIezdfR program. fIEzdfR provides structured graphics in a Scheme
- environment and preceded canvases by a year or two. Its simple
- mechanisms for placing and animating graphical objects inspired the
- functions of canvases.
- .SH "SEE ALSO"
- bind(n), font(n), image(n), scrollbar(n)
- .SH KEYWORDS
- canvas, widget