[ Tklib Table Of Contents | Tklib Index ]
canvas::sqmap(n) 0.3.1 "Variations on a canvas"
canvas::sqmap - Canvas with map background based on square tiles
This package provides an extended canvas widget for the display of maps based on a set of square image tiles. The tiles are the background of the canvas, with all other canvas items added always shown in front of them. The number of tiles shown, tile size, and where to get the images to show are all configurable.
- ::canvas::sqmap pathName ?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.
- canvasName image set cell image
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.
- canvasName image unset cell
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.
- canvasName flush
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.
Note that the canvas does not take ownership of the images it shows in the background. In other words, when we say that the canvas forgets an image this means only that the association between a grid cell and shown image is broken. The image is not deleted. Managing the lifecycle of the images shown by the canvas is responsibility of the user of the canvas.
This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category canvas of the Tklib Trackers. Please also report any ideas for enhancements you may have for either package and/or documentation.