in reply to Re: Using Tk::Text and '<<Modified>>'
in thread Using Tk::Text and '<<Modified>>'

"If you want your routine to be called with every keystroke, then bind every keystroke."

That was my first thought too, but that does not seem to work either.

use warnings; use strict; use Tk; my $MW = MainWindow->new(-title => "Tk::Text test", -width => 200, -height => 200); my $text = $MW->Text(-height => 10, -width => 40, -wrap => 'word'); $text->pack(-side => 'top', -fill => 'both'); $text->bind('<<Modified>>' => sub { getText($text, @_) } ); MainLoop; sub getText { my ($t, @args) = @_; my $str = $t->get('0.0', 'end'); print "Got: $str\n"; $text->bind('<<Modified>>' => sub { getText($str, @_) } ); return if(!$str); return 1; }