Overview of Item Types

Item Options

Every item has several options that can be configured. Some options are available for all item types, and some options are available for just specific item types. All the options are summarized here followed by a complete description of each option. Afterwards, each item type is described with a list of which options apply to that item type.

This is a summary of every itemconfigure option in alphabetical order. Each option either applies to every possible item type, or has a list of item types to which it applies

-aliases [1] (Read-only) Returns all aliases of the item

-alwaysrender [2] True if the item must be rendered, even if the system is slow and the item is small

-anchor [3] The part of the item that -position refers to

-anchorpt [4] The (x, y) portion of -position

-angle [5] Specifies absolute rotation of item

-anglectr [6] Specifies absolute rotation of item, rotating about specified point

-arrow [7] Whether to draw arrow heads with this item

(Available only for line, spline types)

-arrowshape [8] The shape of drawn arrow heads

(Available only for line, spline types)

-bb [9] A script that gets evaluated to specify the bounding box of an item

(Available only for kpl, tcl types)

-border [10] Specifies border color of item

(Available only for html, portal types)

-borderwidth [11] Specifies width of border

(Available only for html, portal types)

-capstyle [12] Specifies how to draw line ends

(Available only for line, spline types)

-clipping [13] Controls if items are clipped to their bounding box when rendered

-command [14] Callback for widgets

(Available only for button, command types)

-dither [15] Render with dithering

(Available only for image types)

-divisible [16] True if events go through a group to its members

(Available only for frame, grid, group, html, panel types)

-donescript [17] A script to evaluate when a background action has completed

(Available only for html types)

-editable [18] True if text item is editable

(Available only for text, textfile, textfield types)

-errorscript [19] A script to evaluate when a background action has an error

(Available only for html types)

-events [20] True if item receives events, false otherwise

-faderange [21] Range over which an item fades in or out

-file [22] File an item should be defined by

(Available only for textfile types)

-fill [23] Specifies fill color of item

(Available only for button, frame, html, label, scrollbar, panel, fill, polygon, portal,

rectangle, textfield types)

-font [24] Specifies font to use for text

(Available only for button, html, label, portal, text, textfile, textfield types)

-from [25] Starting value of valuator widget

(Available only for scrollbar types)

-height [26] Height of an item. Normally computed, but can be set to squash/stretch item

-html [27] The HTML item associated with an htmlanchor

(Available only for htmlanchor types)

-htmlanchors [28] The anchors associated with an HTML page

(Available only for html types)

-image [29] Image data associated with item (allocated by image alloc)

(Available only for htmlanchor, image types)

-info [30] A place to store application-specific information with an item

-ismap [31] True if an htmlanchor is an image map

(Available only for htmlanchor types)

-joinstyle [32] Specifies how to draw the joints within multi-point lines

(Available only for line, spline, oval, polygon, rectangle types)

-layer [33] The layer an item is on

-linesize [34] Amount widget should change to represent a line change

(Available only for scrollbar types)

-lock [35] Locks an item so it can not be modified or deleted

-lookon [36] Specifies the pad widget this item sees

(Available only for portal types)

-maxsize [37] The maximum size an item is rendered it (absolute or relative to window size)

-members [38] The list of members of a group

(Available only for frame, group, html, panel types)

-memberlabels [39] List of labels for a pull-down or pop-up menu

(Available only for menu and choicemenu types)

-menubar [40] Menubar associated with a frame

(Available only for frame types)

-minsize [41] The minimum size an item is rendered it (absolute or relative to window size)

-noisedata [42] Specifies parameters to render item with noise

(Available only for line line types)

-orientation [43] Orientation of widget (horizontal or vertical.)

(Available only for scrollbar types)

-pagesize [44] Amount widget should change to represent a page change

(Available only for scrollbar types)

-pen [45] Specifies pen color of item

(Available only for button, label, line, spline, oval, polygon, portal, rectangle, text

textfile, textfield types)

-penwidth [46] Specifies width of pen

(Available only for line, spline, oval, polygon, rectangle types)

-position [47] The absolute position of the object (x, y, scale)

-reference [48] What item an alias references

(Available only for alias types)

-relief [49] Specifies how border should be rendered (raised, flat, sunken, ridge, groove)

(Available only for button, portal types)

-renderscript [50] A script that gets evaluated every time an item is rendered

-rposition [51] The relative position of the object (to groups)

-scale [52] The (scale) portion of -position

-state [53] State of an item (such as visited, unvisited, etc.)

(Available only for button, htmlanchor types)

-sticky [54] Specifies if an item should stay put when the view changes

-tags [55] List of tags associated with an item

-text [56] The text of any item containing text

(Available only for button, label, text, textfile, textfield types)

-timerrate [57] Frequency timerscript should fire

-timerscript [58] Script associated with an item that fires at regular intervals

-title [59] Some items only: Title of an item

(Available only for portal types)

-to [60] Ending value of valuator widget

(Available only for scrollbar types)

-transparency [61] Transparency of an item. 0 is completely transparent, 1 is completely opaque

-updatescript [62] A script to evaluate when a background action has made progress

(Available only for html types)

-url [63] The URL associated with an item

(Available only for html, htmlanchor types)

-value [64] Current value of valuator widget

(Available only for scrollbar types)

-view [65] Specifies the view this item sees

(Available only for pad, portal types)

-viewscript [66] A script that gets evaluated whenever the view is changed

-visiblelayers [67] The layers that are visible within this view (just for portals and surface, item #1)

(Available only for pad, portal types)

-width [68] Width of an item. Normally computed, but can be set to squash/stretch an item

-writeformat [69] Controls whether disk-based item is written out by copy or reference

(Available only for image types)

-zoomaction [70] A script that gets evaluated when an item is scaled larger or smaller than a set size

This is a list of every itemconfigure option with their complete definition in alphabetical order.

[1] -aliases (read-only)

(Available for all item types)

This returns all the alias items that reference this item.


[2] -alwaysrender boolean

(Available for all item types)


The rendering engine may decide to not render an item for reasons of efficiency (although it may get rendered at higher levels of refinement). When this flag is set (i.e., equals 1), the item will be rendered no matter how big it is (as long as it is bigger than its -minsize. Defaults to false (0).

[3] -anchor anchorPos

(Available for all item types)


AnchorPos tells how to position the object relative to the positioning point for the item (see -position); it may have any of the forms accepted by Tk_GetAnchor. For example, if anchorPos is "center" then the object is centered on the point; if anchorPos is "n" then the object will be drawn so that its top center point is at the positioning point. This option defaults to center.

[4] -anchorpt {x y}

(Available for all item types)


This is an alias for the first two elements of the -position itemconfigure option. (x, y) specifies the anchor point of the item. This means that the item will be positioned so that its anchor (north, center, southwest, etc.) will appear at the specified anchor point. (x, y) are absolute quantities, independent of the current view and independent of any group membership. (Also see the -anchor, -position, -rposition, and -scale itemconfigure options.)

[5] -angle angle

(Available for all item types except HTML and widgets)


Sets the absolute rotation of an item in degrees. The item is rotated around its anchor so that it is rotated angle degrees relative to its creation. (Also see the rotate command.)

[6] -anglectr {angle xctr yctr}

(Available for all item types except HTML and widgets)


Sets the absolute rotation of an item in degrees. The item is rotated around the point (xctr, yctr) so that it is rotated angle degrees relative to its creation. (Also see the rotate command.)

[7] -arrow where

(Available only for line, spline types)


Indicates whether or not arrowheads are to be drawn at one or both ends of the line. where must have one of the values "none" (for no arrowheads), "first" (for an arrowhead at the first point of the line), "last" (for an arrowhead at the last point of the line), or "both" (for arrowheads at both ends). This option defaults to "none".


[8] -arrowshape shape

(Available only for line, spline types)


This option indicates how to draw arrowheads. The shape argument must be a list with three elements, each specifying a distance. 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 Pad++ picks a "reasonable" shape.


[9] -bb boundingboxScript

(Available only for kpl, tcl types)


A script that will be evaluated to compute the bounding box of this item. For Tcl, It should return a 4 element list whose members are "x1 y1 x2 y2" which are the lower left and upper right corners of this items bounding box. For KPL, It should return two two-element vectors that specify (x1, y1), (x2, y2).

[10] -border color

(Available only for html, portal types)

Color specifies a color to use for drawing the border of the portal; it may have any of the forms accepted by Tk_GetColor. If color is "none", the outline will not be drawn. This option defaults to the fill color.


[11] -borderwidth width

(Available only for html, portal types)

Width specifies the width of the border in current units to be drawn around the item. Wide borders will be drawn completely inside the path specified by the points of this object. Note that this is different than pens. If width is 0, then the border will always be drawn one pixel wide, independent of the zoom. Width defaults to 1 pixel.

[12] -capstyle cap

(Available only for line, spline types)

Specifies how the ends of the line are drawn. cap may be one of:

  • butt: The ends are drawn square, at the end point.

  • projecting: The ends are drawn square, past the endpoint.

  • round: The ends are rounded.

[13] -clipping boolean

(Available for all item types)

By default, built-in items (such as lines, text, etc.) do not get clipped to their bounding box, and procedural items (items with -renderscripts) do. This flag turns clipping on or off. Be warned, that turning off clipping for a procedural object is dangerous. If you draw outside the object's bounding box, you can end up with screen garbage. Defaults to true (1) for items with -renderscripts, and false (0) for all other items.

[14] -command script

(Available only for button, command types)

A script that gets executed when the widget is activated. The definition of activation for each widget is different. For example, a button is activated when it is pressed and released while the pointer is still over the button. A scrollbar is activated whenever the thumb is moved. Some widgets append information about the activation on the end of the script (for instance, scrollbars append the current value). See the description of each widget for information about this.

[15] -dither dithermode

(Available only for image types)


Specifies if and when the image is rendered with dithering. Dithering is a rendering technique that allows closer approximation to the actual image colors, even when the requested colors are not available. Rendering images with dithering is much slower than without, so this option allows control as to when (if at all), dithering is used. dithermode may be any of

  • nodither: The image is never rendered with dithering.

  • dither: The image is always rendered with dithering.

  • refinedither: The image is initially rendered without dithering, and then refined with dithering.

Defaults to refinedither (dither only on refinement).


[16] -divisible boolean

(Available only for frame, grid, group, html, panel types)


Specifies whether events should go to the grid members. If -divisible is 1 (true), events never go to the grid object, but pass through it to the members. If the event is within the bounding box of the group, but does not hit any members, then it will be ignored by the group. If -divisible is 0 (false), then the event will go to the group if it is within the bounding box of the group whether there is a member at the place the event points to or not. Defaults to 1 (true).

[17] -donescript script

(Available only for html types)

If script is specified, it gets evaluated when the html item has completed loading - including all in-line images. script is postpended with the id of the html object. This is necessary because the script is typically specified on the create line where the id of the html object is not yet known.


[18] -editable boolean

(Available only for text, textfile, textfield types)

If editable is TRUE, then the item's default event handlers will allow the item to be edited. This applies only to text widgets. Default text editing includes mouse copy and paste, and uses basic emacs-like bindings for manipulating the cursor.


[19] -errorscript script

(Available only for html types)


If script is specified, it gets evaluated if there is an error creating the html item. An error can occur for many reasons - especially because creating an html typically starts a network communication process for fetching the URL. script is postpended with the id of the html object. This is necessary because the script is typically specified on the create line where the id of the html object is not yet known.


[20] -events boolean

(Available for all item types)


Controls whether an item receives input events. If set to false (0), it does not respond to events. Defaults to true (1).

[21] -faderange value

(Available for all item types)


Controls over how long a period an item fades out as it approaches its minimum or maximum size. value specifies this period as a percentage of the object's size (from 0.0 to 1.0). Where 0.0 means that the item doesn't fade out all, it just blinks off when its extreme is reached, and 1.0 means that it slowly fades out over its entire range of sizes. Defaults to 0.3. (Also see the -minsize and -maxsize itemconfigure options.)

[22] -file fileName

(Available only for textfile types)

fileName specifies the filename to read a text file from.

[23] -fill color

(Available for button, frame, html, label, scrollbar, panel, fill, polygon, portal, rectangle, textfield types)


Fill the background of the html item with color, which may be specified in any of the forms accepted by Tk_GetColor. If color is "none", the background will not be drawn. It defaults to the background of the Pad++ widget it is created on.

[24] -font fontname

(Available only for button, html, label, portal, text, textfile, textfield types)


Specifies the font to be used for rendering text for this item. fontname must specify a filename which contains an Adobe Type 1 font, or the string "Line" which causes the Pad++ line-font to be used. Defaults to "Times-12".


[25] -from value

(Available only for scrollbar types)


Specifies the starting (lowest) value for a valuator widget to use. (Also see the -to, -linesize and -pagesize itemconfigure options.)


[26] -height height

(Available for all item types)


By default, the height of every item is automatically computed based on its contents. If the -height option is set, however, then this overrides the automatically computed value. Most items are squashed or stretched to fit the specified height. Note that text and alias items, however, are clipped instead of being squashed or stretched. (Also see the -width itemconfigure option.)

[27] -html

(Available only for htmlanchor types)

Returns the html item this anchor belongs to. This is a read-only option.


[28] -htmlanchors

(Available only for html types)


Returns all the anchors that are part of this HTML item. This is a read-only option, and may not be set.


[29] -image imagetoken

(Available only for htmlanchor, image types)


Specifies the image data associated with this item. Note that changing which image data an item uses does not effect the image data. Specifically, if the -image is set to the empty string, the image data it previously specified is unaffected and still needs to be deallocated with the "image free" command if it is no longer being used. (Also see the image command.)

[30] -info info

(Available for all item types)


A generic info field where the user may place any string. (See the find withinfo command).


[31] -ismap

(Available only for htmlanchor types)


Returns true if this anchor is an imagemap. This is a read-only option.

[32] -joinstyle join

(Available only for line, spline, oval, polygon, rectangle types)

Specifies how the joints at vertices are drawn. join may be one of:

  • bevel: The joints are drawn without protruding. They are cut-off and sharp.

  • miter: The joints are drawn protruding to a point.

  • round: The joints are rounded.

[33] -layer layer

(Available for all item types)

Specifies the layer the item is on. Every item sits on a layer (which is specified by a string), and each view (top-level window and portals) specifies which layers are visible within that view. This gives control over objects are visible where and can be used with portals to implement very simple filters. (See the -visiblelayers itemconfigure option of portals and the top-level window which is specified by the surface (item 1). Defaults to "main".

[34] -linesize value

(Available only for scrollbar types)


Specifies the amount a valuator widget should change to represent a line change. For a scrollbar, this is the amount changed when the trough is clicked. (Also see the -from, -to and -pagesize itemconfigure options.)


[35] -lock lock

(Available for all item types)

When an item is locked, it can not be deleted or modified (except for changing the lock status). Note that attempting to modify or delete a locked item does not generate an error. It fails silently. This is so it is easy to modify all items associated with a tag and if certain items are locked they will just not get modified. The restricted commands on locked items are: coords, delete, itemconfigure, scale, slide, and text.

[36] -lookon surface

(Available only for portal types)

Specifies which Pad++ surface this portals looks onto. surface should be the complete pathName of a Pad++ widget. Defaults to the surface the portal was created on.

[37] -maxsize size

(Available for all item types)


Specifies the maximum size (in current units) this item should be rendered at. That is, if the view is such that the largest dimension of this object is greater than size units, it will not be displayed. When an object is not displayed because it is too large, it does not receive events. When an object approaches its maximum size it will fade out until it completely disappears when it reaches its maximum size. If size is -1, then it has no maximum size and will never disappear because it is too large. See the -faderange itemconfigure option to control how quickly an item fades out.

size may also be specified as a percentage of the view it is visible in (top-level window or portal). To specify size as a percentage, it should be in the range from 0 to 100 and end with a "%". Example:


		.pad ic 5 -minsize 55%

size defaults to 10,000 pixels.

Also note that the rendering engine may decide to not display an item for reasons of efficiency if it is reasonably small. See the -alwaysrender flag to avoid this.

[38] -members members

(Available only for frame, group, html, panel types)


members is a list of object ids that specify the list of members of this group. Setting the members of a group first removes all existing members, and then inserts the new members. The members are rendered in the order they are specified in members.

[39] -memberlabels labels

(Available only for menu and choicemenu types)

Specifies a list of labels that can be used when creating a menu or choicemnu instead of explicitly creating a menuitem for each label. I.e.:

			.pad create menu -memberlabels {"Content" "Index" "Help"} \
				-text "Help"

[40] -menubar menubar

(Available only for frame types)

Specifies the menubar associated with this frame (if any). By associating a menubar with a frame, the menubar is resized so as to be positioned along the top of the frame in the traditional manner. When the frame is resized, the associated menubar is also resized.

[41] -minsize size

(Available for all item types)


Specifies the minimum size (in current units) this item should be rendered at. That is, if the view is such that the largest dimension of this object is less than size units, it will not be displayed. When an object is not displayed because it is too small, it does not receive events. When an object approaches its minimum size it will fade out until it completely disappears when it reaches its minimum size. See the -faderange itemconfigure option to control how quickly an item fades out.

size may also be specified as a percentage of the view it is visible in (top-level window or portal). To specify size as a percentage, it should be in the range from 0 to 100 and end with a "%". Example:


		.pad ic 5 -minsize 55%

size defaults to 0.

Also note that the rendering engine may decide to not display an item for reasons of efficiency if it is reasonably small. See the -alwaysrender flag to avoid this.

[42] -noisedata noisedata

(Available only for line types)

Specifies the noise parameters used to make rough-looking lines. noisedata is a four element list of numbers of the form:

"Pos Freq Amp Steps"

Rough lines are generated using the Perlin noise function. The Perlin noise function is like a sin function with a very irregular amplitude - like sin, noise has a constant period (one), but no two segments of the noise curve are alike. Noisy lines are generated by adding noise to the tangent direction of a line.

In the current implementation, there are four noise parameters: Pos, Freq, Amp, and Steps. Pos determines what part of the noise curve is sampled for that object. Freq determines the rate of sampling, Amp indicates the level, and Steps indicates how many samples to introduce per line segment. The drawing algorithm is straightforward. For each line segment, coordinates are generated as follows:

	DrawRoughLine(x1, y1, x2, y2, Pos, Freq, Amp, Steps) :
		step  = 1.0/Steps;
		mag   = length(x1,y1,x2,y2);
		theta = direction(x1,y1,x2,y2);

		xmag = Amp * sin(theta) * mag;
		ymag = Amp * cos(theta) * mag;

		vertex(x1, y1);

		for (a = step; a < steps; a += step) {
			n = noise(Pos);
			vertex(lerp(a,x1,x2) + n*xamp, lerp(a,y1,y2) + n*yamp);
			Pos += Freq;
		}
		vertex(x2, y2);

Note that we multiply Amp by mag, the length of the line. This is necessary in Pad++ since the zooming functionality means that lines can be of nearly any size. Making the level of noise proportional to the length of the line keeps the informality uniform at all sizes. (We should probably also modulate the number of points generated by the thickness of the line, so small thin lines are cheap).

Values of 0.3 for Freq, 0.1 for Amp, 10 for Steps produces pleasant-looking lines. Pos can be an arbitrary floating point number - giving different objects unique values for Pos ensures that each object has a different appearance.


[43] -orientation orientation

(Available only for scrollbar types)


Specifies the orientation of a rectangular widget. orientation can be "horizontal" or "vertical".


[44] -pagesize value

(Available only for scrollbar types)


Specifies the amount a valuator widget should change to represent a page change. For a scrollbar, this is the amount changed when an arrow is clicked. (Also see the -from, -to and -pagesize itemconfigure options.)


[45] -pen color

(Available for button, label, line, spline, oval, polygon, portal, rectangle, text, textfile, textfield types)

Color specifies a color to use for drawing the line; it may have any of the forms acceptable to Tk_GetColor. It may also be "none", in which case the line will not be drawn. This option defaults to black.

[46] -penwidth width

(Available only for line, spline, oval, polygon, rectangle types)

Width specifies the width of the pen in current units to be drawn around the item. Wide lines will be drawn centered on the path specified by the points. If width is 0.0, then the pen will always be drawn one pixel wide, independent of the zoom. Width defaults to 1 pixel.

[47] -position {x y scale}

-pos is an alias for -position

(Available for all item types)

This specifies an items position and size through three variables (x, y, scale). (x, y) specifies the anchor point of the item. This means that the item will be positioned so that its anchor (north, center, southwest, etc.) will appear at the specified anchor point. scale specifies the magnification of an item. (x, y, scale) are all absolute quantities, independent of the current view and independent of any group membership. Items that have coordinates (lines, rectangles, polygons, and portals) have a default -position which depends on the coordinates of the item. For a "center" anchor (the default), the position will be the center of the coordinates. Other items (that don't have coordinates) have a default position of "0 0 1". (Also see the -anchor, -anchorpt, -rposition, and -scale itemconfigure options.)

The -position option may alternatively be given the special token "center" which means that the item should positioned and scaled so that it biggest dimension fills up 75% of the window, and it is centered. (This is dependent on the current view, and the current window dimensions.)

[48] -reference id

(Available only for alias types)


Specifies the id of an item that an alias references.


[49] -relief relief

(Available only for button, portal types)


Specifies the relief to be used by the border of this item. relief may be any of: raised, sunken, flag, ridge, or groove. Defaults to "ridge"


[50] -renderscript TclScript

(Available for all item types)


Specifies a Tcl script that will be evaluated every time the object is rendered. The script gets executed when the object normally would have been rendered. By default, the object will not get rendered. The script may call the renderitem function at any point to render the object. An example is:

		.pad itemconfigure 22 -renderscript {
			puts "Before"
			.pad renderitem
			puts "After" 
		}

It would be possible to get in an endless render loop with the -renderscript option. If a

-renderscript callback triggers a render which causes that item to be redrawn, the system will be in an endless render loop. To avoid this problem, items do not implicitly trigger damage within a

-renderscript callback. If you do want to explicitly damage an item within a -renderscript callback, you must use the damage command. Be very careful to avoid infinite render loops.

[51] -rposition {x y scale}

-rpos is an alias for -rposition

(Available for all item types)

This is similar to the -position itemconfigure option, but (x, y, scale) are relative to the current group's position (whereas they are absolute for -position.) If setting this option on an item that is not a member of a group, then it behaves identically to -position. If setting this option on an item that is a member of a group, then the item will actually appear at a position that is first specified by the item's position, and then transformed by the group's position. Note that this option can be difficult to use and generally is not recommend. (Also see the -anchor, -anchorpt, -position, and -scale itemconfigure options.)

[52] -scale scale

(Available for all item types)


This is an alias for the first last (third) element of the -position itemconfigure option. scale specifies the magnification of an item, and is an absolute quantity, independent of the current view and independent of any group membership. (Also see the -anchor, -anchorpt, -position, and -rposition itemconfigure options.)

[53] -state state

(Available only for button, htmlanchor types)


Specifies the state of the anchor (which controls its color). There is no direct control over an anchor's color. Rather, it uses the default colors unless the HTML page specifies anchor colors. State may be one of "unvisited", "active", "visited", or "notloaded". In-line images that haven't been loaded yet are

"notloaded".

[54] -sticky style

(Available for all item types)

Specifies if this item should be "sticky". Sticky items are constrained by the view so that whenever the view changes, sticky items are moved in response. There are several different kinds of sticky constraints. The simplest one (style == '1') makes the sticky item "stick" to the screen, independent of the current view. That is, as the view pans and zooms, sticky items appear effectively stuck to the screen. The different kinds of sticky constraints are described in detail below. Sticky items are rendered in their normal stacking order, and thus sticky items can appear above or below non-sticky items. (See the getview and moveto commands.) Defaults to 0 (false).

There are four kinds of sticky objects. They are:

  • Regular sticky items (style == '1'). These don't move at all as the view changes.

  • "Sticky Z" items (style == 'z'). These do not zoom, but they pan normally. That is, they when the view changes, their (x, y) position does not change, but their scale is recalculated so their size does not change. This can be appropriate for handles or labels where you don't want their size to change, but you do want them to stay with other related objects. As a result of this, the old 'handle' object type has now been deleted. The previous handles never worked quite right within portals (they left screen junk), and their functionality is almost completely replaced by sticky z objects. Note that one thing sticky z objects can not do that handles did do is that sticky z objects don't scale only at the top-level view. Since they are otherwise regular objects, they can appear scaled within portals.

Example: The following code creates a rectangle with 4 non-zooming "handles" on its corners.

				set rect [.pad create rectangle 0 0 100 100 -fill white]
				.pad create rectangle 0 0 6 6 -fill red -pos "0 0 1" -sticky z
				.pad create rectangle 0 0 6 6 -fill red -pos "100 0 1" -sticky z
				.pad create rectangle 0 0 6 6 -fill red -pos "0 100 1" -sticky z
				.pad create rectangle 0 0 6 6 -fill red -pos "100 100 1" -sticky z

  • "Sticky X" items (style == 'x'). This is like sticky z, but the items also don't pan horizontally.

  • "Sticky Y" objects (style == 'y'). This is like sticky z, but the items also don't pan vertically.

  • "Sticky view" objects (style == 'view'). This is like sticky z, but the items always stays within the view - and the constrained position is remembered, so that the object does not "want" to stay in its original position as it does with the other sticky types. Instead, once it is moved to stay within the view, the new position is its preferred position, and it sticks there.

[55] -tags tagList

(Available for all item types)


Specifies a set of tags to apply to the item. TagList consists of a list of tag names, which replace any existing tags for the item. TagList may be an empty list.

[56] -text string

(Available only for button, label, text, textfile, textfield types)

String specifies the characters to be displayed in the text item. Newline characters cause line breaks, and tab characters are supported. This option defaults to an empty string.

[57] -timerrate rate

(Available for all item types)


Specifies the frequency in milliseconds that the object's timerscript should be evaluated. If it is set to 0, the timer is turned off. Defaults to off (0). (see -timerscript).


[58] -timerscript TclScript

(Available for all item types)


Specifies a Tcl script that will be evaluated regularly, every rate milliseconds as specified by -timerrate (if -timerrate is greater than zero). This evaluation is independent of rendering and events. Returns the current TclScript for the object. (see -timerrate).


[59] -title title

(Available only for portal types)


If title is specified, then the portal will be rendered with a titlebar consisting of title. Otherwise, no title bar is drawn. Defaults to the empty string.


[60] -to value

(Available only for scrollbar types)


Specifies the ending (highest) value for a valuator widget to use. (Also see the -from, -linesize and -pagesize itemconfigure options.)


[61] -transparency value

(Available for all item types)


Specifies the transparency an item is drawn with. value must be a value between 0.0 and 1.0 where 0.0 is completely transparent and 1.0 is completely opaque. 1.0 is the default. If a portal or group is partially transparent, all of its member or visible objects, respectively, will have their transparency multiplied by the portals or groups.

[62] -updatescript script

(Available only for html types)


If script is specified, it gets evaluated when the html source has loaded, and then once every time an in-line is loaded. script is postpended with the id of the html object. This is necessary because the script is typically specified on the create line where the id of the html object is not yet known.


[63] -url urlname

(Available only for html, htmlanchor types)


Specifies the URL (Universal Resource Locator, or World-Wide Web address) that this html page should be accessed from. It must be specified with a valid address. Some examples are: "http://www.unm.edu", "http://www.cs.unm.edu/bederson", "file://nfs/u3/bederson/public_html/begin.html", "home-page.html".


[64] -value value

(Available only for scrollbar types)


Specifies the value of valuator widget. For instance, this specifies the position of the thumb on a scrollbar.


[65] -view {x y zoom}

(Available only for pad, portal types)


Specifies the location of this view. For top-level views (i.e., Pad++ surfaces), this changes the whole view. For portals, this changes the view within the portal. (x, y) specifes the point at the center of the view, and zoom specifies the magnification. For Pad++ surfaces, this defaults to (0, 0, 1). For portals, this defaults to directly under the location the portal was created at. (Also see the moveto command.)

[66] -viewscript TclScript

(Available for all item types)


Specifies a Tcl script that will be evaluated every time the view onto the Pad++ surface is changed. This script gets executed after the view coordinates have changed, but before the new scene gets rendered. Returns the current viewscript.

[67] -visiblelayers layers

(Available only for pad, portal types)


Specifies what layers are visible within this portal. layers can be either a list of layers which will specify which items will be displayed within this portal, or take the special form of "all -layer1 -layer2 -layer3 ..." in which case all layers except the ones specified will be displayed. Defaults to "all". layers may also take the special value "none" which means that no layers are visible. (See the -layer itemconfigure option that all items have.)

[68] -width width

(Available for all item types)


By default, the width of every item is automatically computed based on its contents. If the -width option is set, however, then this overrides the automatically computed value. Most items are squashed or stretched to fit the specified width. Note that text and alias items, however, are clipped instead of being squashed or stretched. (Also see the -height itemconfigure option.)


[69] -writeformat [copy | reference]

(Available only for image types)


This option controls whether objects that are created from disk-based data are saved by storing a copy of all of the original data, or it references the original file. If the file is written as text, then the copy option to writeformat makes copies of the original datafiles so that there are multiple files created. The binary option results in writing the data in the output file.

[70] -zoomaction {size growScript shrinkScript}

(Available for all item types)

Specifies a pair of Tcl scripts that gets evaluated when an item grows or shrinks such that its size crosses the specified zoomaction size. This is a simple way of making "semantically zoomable" objects - that is, objects that look different when they are rendered at different sizes. When the item grows larger than size, growScript is evaluated, and when it shrinks smaller than size, shrinkScript is evaluated.

Any number of pairs of scripts may be associated with different sizes. Each use of -zoomaction may specify a different size, or modify scripts for an existing size. If both scripts are empty strings, then that zoomaction is deleted. This returns a list of zoomaction size, growScript, shrinkScript triplets.

Note that for a zoomaction to work, the item must get rendered on both sides of the size. It is possible to create an object and then immediately change its size before it gets rendered. In this case, the zoomaction will not get fired.

The script gets executed when the object normally would have been rendered. By default, the object will not get rendered. The script may call the renderitem function at any point to render the object. See the description of -renderscript for an example. The deletion of items during a zoomaction is delayed until after the current render is finished.

Here is an example that turns a rectangle into an image when it is zoomed in, and back into the rectangle when zoomed out:

		proc grow {} {
			.pad ic rect -transparency 0
			.pad pushcoordframe rect
			set image_token [.pad image alloc images/unm_logo_orig.gif]
			.pad create image -image $image_token -anchor sw -tags "image"
			.pad popcoordframe
			.pad renderitem  
		}

		proc shrink {} {
			.pad ic rect -transparency 1
			set image_id [.pad find withtag image]
			if {$image_id != ""} {
				set image_token [.pad ic image -image]
				.pad freeimage $image_token
				.pad delete image
			}
			.pad renderitem
		}

		proc testzoomaction {} {
			.pad create rectangle 0 0 341 222 -pen black -fill yellow3 \
				-zoomaction {250 grow shrink} -tags "rect"
		}


Pad++ Reference Manual - 20 JUN 1997

Copyright Computer Science Department, The University of New Mexico

Web Accessibility