If the OP wants to capture key stroke, then should use KeyRelease etc. If what the OP cares is whether the context has been modified, then:
use Tk;
use Tk::Dialog;
use warnings;
use strict;
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( '<FocusOut>' => \&callback);
my $text2 = $MW->Text(-height => 10,
-width => 40,
-wrap => 'word');
$text2->pack(-side => 'top', -fill => 'both');
MainLoop;
sub callback {
if ($text->editModified()) {
$text->Dialog(-title=>"Modified",-text=>"\$text has been modif
+ied")->Show();#or whatever you want
$text->editModified(0);
}
}
|