::canvas::sqmappathName ?options?
Creates the canvas pathName and configures it. The new widget supports all of the options and
methods of a regular canvas, plus the options and methods described below.
The result of the command is pathName.
OPTIONS-grid-cell-width
The value for this option is a non-negative integer. It specifies the width of the cells the
background is made up of.
-grid-cell-height
The value for this option is a non-negative integer. It specifies the height of the cells the
background is made up of.
-grid-cell-command
The value for this option is a command prefix. It is invoked whenever the canvas needs the image
for a specific cell of the background, with two additional arguments, the id of the cell, and a
command prefix to invoke when the image is ready, or known to not exist.
The id of the cell is a 2-element list containing the row and column number of the cell, in this
order. The result command prefix (named "$result" in the example below) has to be invoked with
either two or three arguments, i.e.
$result set $cellid $image ; # image is known and ready
$result unset $cellid ; # image does not exist
This option may be left undefined, i.e. the canvas can operate without it. In that case the only
images shown in grid cells are those explicitly set with the method imageset, see the next
section. All other grid cells will simply be empty.
-viewport-command
This option specifies a command prefix to invoke when the viewport of the canvas is changed, to
allow users keep track of where in the scroll-region we are at all times. This can be used, for
example, to drive derivate displays, or to keep items in view by moving them as the viewport
moves.
-image-on-load
The value for this option is an image. If specified the image is shown in a cell while the actual
image for that cell is getting loaded through the callback specified by the -grid-cell-command.
-image-on-unset
The value for this option is an image. If specified the image is shown in a cell for which the
callback specified by the -grid-cell-command reported that there is no actual image to be shown.
METHODScanvasNameimagesetcellimage
Invoking this method places the image into the specified cell of the background. The cell is given
as a 2-element list containing row and column number, in this order.
Note that an image is allowed to be associated with and displayed in multiple cells of the canvas.
canvasNameimageunsetcell
Invoking this method declares the specified cell of the background as empty, an existing image
shown by this cell will be forgotten. The cell is given as a 2-element list containing row and
column number, in this order.
canvasNameflush
Invoking this method forces the canvas to completely reload the images for all cells. Do not use
this method if the canvas is operated without a -grid-cell-command, as in that case the canvas
will simply forget all images without being able to reload them.