use subs qw/items_button_press items_drag items_enter items_leave items_mark
items_start_drag items_stroke items_under_area/;
use vars qw/$TOP/;
sub items {
# Create a top-level window containing a canvas that displays the various
# item types and allows them to be selected and moved.
my($demo) = @_;
$TOP = $MW->WidgetDemo(
-name => $demo,
-text => ["This window contains a canvas widget with examples of the various kinds of items supported by canvases. The following operations are supported:\n Button-1 drag:\tmoves item under pointer.\n Button-2 drag:\trepositions view.\n Button-3 drag:\tstrokes out area.\n Ctrl+f:\t\tdisplays items under area.", qw/-wraplength 5i/],
-title => 'Canvas Item Demonstration',
-iconname => 'items',
);
my $c = $TOP->Scrolled(qw/Canvas -width 15c -height 10c -relief sunken
-borderwidth 2 -scrollbars se -scrollregion/ =>
[qw/0c 0c 30c 24c/]);
$c->pack(qw/-expand yes -fill both/);
my %iinfo = (); # item information hash
$iinfo{areaX1} = 0;
$iinfo{areaY1} = 0;
$iinfo{areaX2} = 0;
$iinfo{areaY2} = 0;
$iinfo{restore_cmd} = '';
if ($Tk::VERSION cmp '800.015') {
# Display a 3x3 rectangular grid (800.016 or greater).
$c->createText(qw/25c 8.2c -text Text -anchor n/);
$c->createRectangle(qw/22.4c 8.9c 22.6c 9.1c/);
$c->createText(qw/22.5c 9c -anchor n -width 4c/, -font => $font1,
-text => 'A short string of text, word-wrapped, justified left, and anchored north (at the top). The rectangles show the anchor points for each piece of text.', qw/-tags item/);