use subs qw/ctext_bs ctext_configure ctext_enter ctext_move ctext_press/;
use vars qw/$TOP/;
sub ctext {
# Create a window containing a canvas displaying a text string and
# allowing the string to be edited and re-anchored.
my($demo) = @_;
$TOP = $MW->WidgetDemo(
-name => $demo,
-text => ['This window displays a string of text to demonstrate the text facilities of canvas widgets. You can click in the boxes to adijust the position of the text relative to its positioning point or change its justification. The text also supports the following simple bindings for editing:
1. You can point, click, and type.
2. You can also select with button 1.
3. You can copy the selection to the mouse position with button 2.
4. Backspace and Control+h delete the selection if there is one;
otherwise they delete the character just before the insertion cursor.
5. Delete deletes the selection if there is one; otherwise it deletes
the character just after the insertion cursor.', qw/-wraplength 5i/],
$c->create(qw/rectangle 245 195 255 205 -outline black -fill red/);
# First, create the text item and give it bindings so it can be edited.
$c->addtag(qw/text withtag/,
$c->create('text', 250, 200,
-text => 'This is just a string of text to demonstrate the text facilities of canvas widgets. Bindings have been been defined to support editing (see above)."',