next up previous 79
Next: ADAM Message System Extension
Up: The GWM Extension
Previous: Tk Procedures


GWM Canvas item

A gwm canvas item is a rectangular area of a canvas widget that has been turned into a gwm window.

The canvas item duplicates much of the functionality of the gwm widget except that:

The canvas item does not support overlays.
Printing to JPEG or LJ250 format is not supported.
Printing is not done as a background activity so the Tk application freezes while the canvas is being printed.
Only one gwm item can exist on any particular canvas
There is no crosshair (although this can easily be implemented with line canvas items). widget.

The important additional functionality that the canvas item offers is the ability to overlay the gwm picture with other canvas item; since these items can be manipulated through Tcl procedures it is possible to write programs that enable the user to interact with graphics in a much wider variety of ways than is possible though GKS or IDI alone. However, any drawing done by an external program will overwrite any existing canvas items until the window is redrawn by Tk; the easiest way to force the window to be redrawn is to use the canvas raise or lower commands (for example, to ``lower'' the gwm canvas item so that it is underneath all other items).

Gwm items are created with widget commands of the following form:

pathName create gwm x y option value option value ...

The arguments x and y give the coordinates of the item's top left hand corner. After the coordinates there may be any number of option-value pairs, each of which sets one of the configuration options of the item. The same option-value pairs may be used in itemconfigure widget commands to change the item's configuration. The following options are supported for gwm items:

-background colour
-bg colour

Specifies the background colour (colour table entry 0) of the gwm window. Defaults to Black.

-colours number

Specifies the number of colours that the gwm window will attempt to allocate for its colour table. Setting this option after the item has been created has no effect. Defaults to 64.

-command number

Specifies the name of the command that is created to clear (erase the picture in) the item and modify the colour table. If no value is specified, no command will be created. Changing this option after the item has been created has no effect.
command clear
clears the item.
command set colour n colour
sets colour table entry n to colour.
command get colour n
returns the colour stored in colour table entry n.

-foreground colour
-fg colour

Specifies the foreground colour (colour table entry 1) of the gwm window. Defaults to White.

-gwmname name
-name name

Specifies the name of the gwm window. Setting this option after the item has been created has no effect. The gwm name is the name used by graphics programs to connect to the window. Defaults to ``xwindows''.

-height height

Specifies the width of the gwm item. The value is in any of the forms acceptable to Tk_GetPixels. Changing this option after the item has been created has no effect. Defaults to 512 pixels.

-mincolours number

Specifies the minimum number of colours that the gwm window should allocate for its colour table. If fewer than this number of colours are available, the creation of the item will fail. Changing this option after the item has been created has no effect. Defaults to 2.

-tags taglist

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.

-width width

Specifies the width of the gwm item. The value is in any of the forms acceptable to Tk_GetPixels. Changing this option after the item has been created has no effect.



next up previous 79
Next: ADAM Message System Extension
Up: The GWM Extension
Previous: Tk Procedures

STARTCL --- Starlink Extensions to Tcl & Tk
Starlink User Note 186
D. L. Terrett
3 March 1999
E-mail:ussc@star.rl.ac.uk

Copyright © 2009 Science and Technology Facilities Council