package Tk::TextConfig; use strict; use Tk; our @ISA; use base qw(Tk::Derived); Construct Tk::Widget 'TextConfig'; sub new { my $package = shift; my $parent = shift; my $kind = shift; my $targetclass = "Tk::$kind"; eval "require $targetclass"; push @ISA, $targetclass; my $object = $targetclass->new($parent, @_); bless $object, "Tk::TextConfig"; # reblessing ? return $object; } my $LinkTagPrefix = 'Link_'; sub insertLink { my ($self, $index, $chars, $action) = @_; my $cnt = ++$self->{'TCcounters'}{'link'}; my $uniquename = $LinkTagPrefix.$cnt; $self->insert($index, $chars, $uniquename); $self->tagConfigure($uniquename, qw/-foreground blue -underline 1 -data/, $action); # ...... $self->tagBind($uniquename, '', 'keyLink'); # Wrong # This kind of binding has strange behaviour (bug?) # It is related to the 'current' mark instead of the 'insert'. # So it depends on mouse position # Anyway, it seems that Tk::Text tag bindings has noting common with widget's bindings # Actually we cannot do Tk->break from sub keyLink }