NAME

Tk::GraphItems::TextBox - Display nodes of relation-graphs on a Tk::Canvas

SYNOPSIS

  require Tk::GraphItems::TextBox;
  require Tk::GraphItems::Connector;
  ...
  my $node = Tk::GraphItems::TextBox->new(canvas=> $can,
					  text  => "new_node",
                                          font  => ['Courier',8],
					  'x'   => 50,
				       	  'y'   => 50);
  $node->move(10,0);
  $node->set_coords(50,50);
  $node->text($node->text()."\nanother_line");
  $node->colour('red');

DESCRIPTION

Tk::GraphItems::TextBox provides objects to display nodes of relation-graphs on a Tk::Canvas widget.

SEE ALSO

Documentation of Tk::GraphItems::Connector. Examples in Tk/GraphItems/Examples.

METHODS

Tk::GraphItems::TextBox supports the following methods:

new(canvas=> $a_canvas, x => $x_coord, y => $y_coord, text => $textB, font => $aTkFont<)>

Return a new TextBox instance and display it on the given 'Canvas'. The canvas-items will be destroyed with the TextBox-instance when it goes out of scope.

set_coords($x,$y)

Set the (center)coordinates of this node. If two references are given as argumnents, the referenced Scalar-variables will get tied to the coordinates properties of the node.

get_coords

Return the (center)coordinates of this node.

move($d_x,$d_y)

Move the node by ($d_x,$d_y) pixels.

text([$a_string])

Sets the displayed text to $a_string, if the argument is given. Returns the current text, if called without an argument.

colour([$a_Tk_colour])

Sets the background to $a_Tk_colour, if the argument is given. Returns the current colour, if called without an argument.

bind_class('event',$coderef)

Binds the given 'event' sequence to $coderef. This binding will exist for all TextBox instances on the Canvas displaying the invoking object. The binding will not exist for TextBox items that are displayed on other Canvas instances. The TextBox instance which is the 'current' one at the time the event is triggered will be passed to $coderef as an argument. If $coderef contains an empty string, the binding for 'event' is deleted.

was_dragged

Returns a true value in case a <B1-Motion> occured after the last <B1>. You may want to check this when binding to <B1-Release>, to make sure the action was a 'click' and not a 'drag'.

AUTHOR

Christoph Lamprecht, ch.l.ngre@online.de

COPYRIGHT AND LICENSE

Copyright (C) 2006 by Christoph Lamprecht

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.7 or, at your option, any later version of Perl 5 you may have available.