Tk Library Source Code

Documentation
Login


[ Main Table Of Contents | Table Of Contents | Keyword Index | Categories | Modules | Applications ]

NAME

canvas::edit::rectangle - Editing a rectangle on a canvas

Table Of Contents

SYNOPSIS

package require Tcl 8.5
package require Tk 8.5
package require canvas::edit::points ?0.1?
package require canvas::edit::rectangle ?0.1?

::canvas::edit rectangle objectName canvas options...
objectName destroy
objectName enable
objectName disable
objectName active
objectName set minx miny maxx maxy
objectName clear
activeCmd editorObj id
createCmd canvas x y
dataCmd editorObj coordinates

DESCRIPTION

This package provides a class whose instances handle editing a rectangle on a canvas. Instances can be configured with regard to the visual appearance of the markers denoting the rectangle's corners. Note that instances do not store the edited rectangle themselves, but delegate this to a configurable object.

Interaction

The rectangle editor internally uses an instance of package canvas::edit::points, and inherits all the options and behaviours for it. The color options are additionally applied to the rectangle element of this editor

Beyond that it provides an option, -rect-config, to customize the rectangle item used to render the rectangle through its corners. Note that it cannot overide the inherited color options.

During interaction instances execute a state machine where the user creates two points, at which point the system completes the rectangle with the missing corners and reports it. At that point the system prevents adding more points. Dragging the points is still possible, enabling resizing and moving the rectangle. Deleting any corner deletes the entire rectangle, at which point the system is again ready for the creation of a new rectangle from two points.

Class API

Instance API

Instances of the rectangle editors provide the following API:

Options

The class command accepts the following options

Bugs, Ideas, Feedback

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.

KEYWORDS

canvas, editing, rectangle