Canvas Attributes

   

Practical Programming in Tcl & Tk, Third Edition
By Brent B. Welch

Table of Contents
Chapter 34.  The Canvas Widget


Table 34-13 lists the attributes for the canvas widget. The table uses the resource name, which has capitals at internal word boundaries. In Tcl commands, the attributes are specified with a dash and are all lowercase.

Table 34-13. Canvas attribute resource names.
backgroundThe normal background color.
borderWidthThe width of the border around the canvas.
closeEnoughDistance from mouse to an overlapping object.
confineBoolean. True constrains the view to the scroll region.
cursorCursor to display when mouse is over the widget.
heightHeight, in screen units, of canvas display.
highlightBackgroundFocus highlight color when widget does not have focus.
highlightColorColor for input focus highlight border.
highlightThicknessWidth of highlight border.
insertBackgroundBackground for area covered by insert cursor.
insertBorderwidthWidth of cursor border. Nonzero for 3D effect.
insertOffTimeTime, in milliseconds the insert cursor blinks off.
insertOnTimeTime, in milliseconds the insert cursor blinks on.
insertWidthWidth of insert cursor. Default is 2.
reliefflat, sunken, raised, groove, solid, or ridge.
scrollIncrementThe minimum scrolling distance.
scrollRegionLeft, top, right, and bottom coordinates of the canvas.
selectBackgroundBackground color of selection.
selectForegroundForeground color of selection.
selectBorderWidthWidth of selection border. Nonzero for 3D effect.
takeFocusControls focus changes from keyboard traversal.
widthWidth in screen units for viewable area.
xScrollCommandTcl command prefix for horizontal scrolling.
xScrollIncrementDistance for one scrolling unit in the X direction.
yScrollCommandTcl command prefix for vertical scrolling.
yScrollIncrementDistance for one scrolling unit in the Y direction.

The scroll region of a canvas defines the boundaries of the canvas coordinate space. It is specified as four coordinates, x1 y1 x2 y2 where (x1, y1) is the top-left corner and (x2, y2) is the lower-right corner. If the confine attribute is true, then the canvas cannot be scrolled outside this region. It is OK to position canvas objects partially or totally off the scroll region; they just may not be visible. The scroll increment attributes determine how much the canvas is scrolled when the user clicks on the arrows in the scrollbar.

The closeEnough attribute indicates how far away a position can be from an object and still be considered to overlap it. This applies to the overlapping search criteria.


       
    Top
     



    Practical Programming in Tcl and Tk
    Practical Programming in Tcl and Tk (4th Edition)
    ISBN: 0130385603
    EAN: 2147483647
    Year: 1999
    Pages: 478

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net