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

I asked a similar question awhile back, and some of the experts had some pointers, but I've yet to fully explore them. Go to http://groups.google.com and search for " Re: Tk:Text "has been changed" flag? ".

At the time I decided it was easier to just take md5sums of the whole text and compare them. :-)


I'm not really a human, but I play one on earth. flash japh

Replies are listed 'Best First'.
Re^2: Using Tk::Text and '<<Modified>>'
by pg (Canon) on Nov 20, 2004 at 18:16 UTC

    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); } }